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

The tl:dr; How would you go about tracking down a url rewrite that should not be happening?


The details: I have one .htaccess file and it is simply:

RewriteEngine On

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

Rewrite is enabled. When I visit a url like the following:

foo.com/index.php I get what I expect. foo.com/index/ however will redirect to foo.com/index.htm

So in my app route like foo.com/index/books/fiction will become foo.com/index.htm/books/fiction

Where could this be getting set? I thought it could be in my vhosts file but that looks like:

<VirtualHost *:80>
        ServerAdmin webmaster@localhost

        DocumentRoot /var/www
        <Directory />
                Options FollowSymLinks
                AllowOverride All
        </Directory>
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>
etc...

which looks pretty vanilla to me. I then though is could be my DirectoryIndex (located in apache2's mods-enabled directory) needed to be specified so I changed that to:

<IfModule mod_dir.c>

          DirectoryIndex index.php index.phtml index.html

</IfModule>

But no luck. I'm not sure where else to look. Any suggestions?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Activate debug logging in your logging environment and call that URL. Apache should create a detailed log where it went down the road. At least that's what nginx does in debug mode.

I have no clue why this is happening, but you could try:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^ index.php [L]

Instead of your rewrite which checks the other way around. MultiViews could also be a problem.

share|improve this answer

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.