Wednesday, October 23, 2013

setup domain redirection on .htaccess apache2

I- enable mod rewrite
# cat /etc/apache2/mods-enabled/rewrite.load
LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so


II- enabled directory of the website to use use rewrite mode
# cat /etc/apache2/conf-enabled/makma.conf
<Directory /var/www/dr/>
AllowOverride All
</Directory>


III- create .htaccess in /var/www/dr and set rule to redirect,
I set all request to makma.com redirect to www.youtube.com

root@localhost:/var/www/dr# cat .htaccess
RewriteEngine on
RewriteCond %{HTTP_HOST} ^makma.com
RewriteRule ^(.*)$ http://www.youtube.com/$1 [R=permanent,L]

No comments:

Post a Comment