Can't Redirect Domain to Subdomain

February 28, 2014 1.8k views
I'd like to redirect this domain to this subdomain I've created a mod_rewrite and edited the .htaccess file but it doesn't seem to work. I'm currently using this: DirectoryIndex portal.php index.php index.html index.htm
7 Answers
try this

RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_URI} ^$
RewriteCond %{HTTP_HOST} ^$
RewriteRule ^$ [L,R=301]
Thanks for the reply. It still doesn't work though.
Have you tried restarting Apache?
I've restarted apache and it still doesn't work. I've checked the error logs and it doesn't have anything about failing to redirect. Could this be a problem with mod_rewrite or the apache configuration in general?
Is mod_rewrite enabled? What OS are you using?
It is enabled as far as I can tell. When I type in sudo a2enmod rewrite it says Module rewrite already enabled.

Ubuntu 12.04.3 x64
Set AllowOverride to All in your virtualhost config, does that fix it?
Have another answer? Share your knowledge.