Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a long standing problem with mod_rewrite and 1and1 shared hosting (hope that being shared hosting does't get this migrated to 'sharedserverfault'). Everything about the rewrite rules work fine - except when 'index' is in the path. Then I get an Apache 404 error.

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ /index.php [NC,L]

Pretty standard so far, works fine on most server. On 1and1's server I get a 404 error if index is the top 'directory'. Anything starting with 'http://example.com/index' will give a 404.

If I copy index.php to bootstrap.php and change the .htaccess file to point there and delete index.php, it will work.

However, that makes it a pain to update the server - any ideas what apache settings are causing this? Obviously I can't change the main configuration file, but I can override settings with the .htaccess file.

share|improve this question

2 Answers 2

up vote 2 down vote accepted

Found the answer here:

After some digging around, the solution is to disable something called MultiViews. The MultiViews option allows a file to be called even if the extension is not loaded, so index would look for any files called index, regardless of their extension.

So the solution is to add:

Options -MultiViews

to the .htaccess file.

share|improve this answer

If you name a file index and put it in your root, does it 404, or load that file? I would try overriding the DirectoryIndex directive in your.htaccess file. The default there is usually index.html, but maybe yours is just index.

share|improve this answer
    
I'll do some testing, but either way, shouldn't the rewrite work (since the file doesn't exist)? –  Tim Lytle Oct 10 '09 at 1:50

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.