Can't Redirect Domain to Subdomain

Posted February 28, 2014 4.2k 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

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
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?