Clean URL's

To use clean URL’s this is the code in my .htaccess in the root:

[php]RewriteBase /
ErrorDocument 404 http://www.domain.com/404/
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^([^/]+)/$ $1.php
RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ /$1/ [R=301,L][/php]

This works perfectly for domain.com/something/ or domain.com/something/somethingelse/ but it does not work with domain.com/something/somethingelse/athirdsomething/. I need a third something :frowning: Please help :slight_smile:

Sorry, I forgot to add that I get a 404 when I click on a link going into that third something so it IS reading the .htaccess to get the 404 info its just not accepting the rewrite?

Uh, in the subject I meant URL’s not URI’s. Oops.

Sorry I am not good with regex

try changing
[php]RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.php[/php]

to or adding
[php]RewriteRule ^([^/]+)/([^/]+)/([^/]+)/$ /$1/$2.php[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service