.htaccess redirect working on localhost but not on server

Posted by Thread7 on Server Fault See other posts from Server Fault or by Thread7
Published on 2012-12-14T20:54:02Z Indexed on 2012/12/14 23:07 UTC
Read the original article Hit count: 151

Filed under:
|

I want users who hit my web site's root directory to be sent to a subdirectory. So anyone going to: http://MyDomain.com or /index.php would be sent to http://MyDomain.com/subdir

I used the .htaccess file to successfully do this on my local machine (with Apache 2). But it doesn't work on the server? Users still see the default index.php in the root directory. Here is my simple .htaccess file. Any ideas?

RewriteEngine On
Redirect /index.php http://MyDomain.com/subdir/

Now my httpd.conf file

AccessFileName .htaccess
<Directory />
  Options FollowSymLinks
  AllowOverride All
</Directory>
<Directory "/var/www/icons">
  Options Indexes MultiViews FollowSymLinks
  AllowOverride None
  Order allow,deny
  Allow from all
</Directory>
<Directory "/var/www/cgi-bin">
  AllowOverride None
  Options None
  Order allow,deny
  Allow from all
</Directory>
<IfModule mod_negotiation.c>
<IfModule mod_include.c>
<Directory "/var/www/error">
    AllowOverride None
    Options IncludesNoExec
    AddOutputFilter Includes html
    AddHandler type-map var
    Order allow,deny
    Allow from all
    LanguagePriority en es de fr
    ForceLanguagePriority Prefer Fallback
</Directory>
</IfModule>
</IfModule>

© Server Fault or respective owner

Related posts about apache2

Related posts about webserver