Skip to content

Instantly share code, notes, and snippets.

@zayarwinttun
zayarwinttun / .htaccess
Created December 1, 2015 16:25
url canonicalization redirect
RewriteEngine On
# www.example.com to example.com
RewriteCond %{HTTP_HOST} ^www\.example\.com$
RewriteRule ^/?$ "http\:\/\/example\.com\/" [R=301,L]
# example.com to www.example.com
RewriteCond %{HTTP_HOST} !^www.example.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
@zayarwinttun
zayarwinttun / servicecheck.sh
Created November 30, 2015 15:34
shell script for httpd, mysql service check and restart on down
#!/bin/bash
#about: checking services, if down ? restart
#note: dont forget to add this script to cron for automation
#define services to check
services=( "httpd" "mysqld" )
for service in "${services[@]}"
do