tags:

views:

16

answers:

2

I have the following htaccess to allow for no file extensions in the url:

Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ $1.php

My problem is that i have both a file called images.php and a folder called images, so when i use the url: .com/images - it takes me to the images folder, where as: .com/contact - takes me to the correct page.

A: 

RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d

With these 2 lines, you say if the test string (in your case 'images') is not a directory and is not a file, rewrite it to images.php. Now, since you have images directory, the second rule is not satisfied and images is rewriten to images.php internaly.

Either change the name of the folder, change the name of the script, or change the .htaccess rules and conditions.

dekomote
What would i change the htacces conditions to? I have tried every combination of -f and -d with removing them and reversing them(!) and still it looks for the folder first
slexAtrukov
A: 

I think if you add before your rule this rule suppose to work ...(but I didn't test it)

RewriteRule ^images/(.*)$    images/$1.php [L]
jatt