Problem: Traffic comes to http://krevatas.net/{something} but they really need to go to http://kostas.krevatas.net/{something}.
Solution: 301 Redirect via Apache with mod_rewrite.
Simple easy addition to your httpd.conf or .htaccess, I placed mine right above my wordpress mod_rewrite rules. If you are using .htaccess just dump it in that file above the wordpress redirect, if you having your rewrite rules in your httpd.conf then it needs to go inside the container:
1 2 3 4 5 |
<Directory /www/mydir/> RewriteEngine On RewriteCond %{HTTP_HOST} !^kostas\.krevatas\.net$ [NC] RewriteRule ^(.*)$ http://kostas.krevatas.net/$1 [R=301,L] </Directory> |
What we mean by these lines:
- Everything that does not start with kostas.krevatas.net{something}
- Should redirect to kostas.krevatas.net/{something}
With some credits to http://aknosis.com