Htaccess remove .php extension, index.php AND add trailing slash?

Remove . Php; use THE_REQUEST to prevent infinite loops RewriteCond %{HTTP_HOST} ^www\. Domain\.

Com RewriteCond %{THE_REQUEST} ^GET\ (.*)\. Php\ HTTP RewriteRule (.*)\. Php$ $1 R=301 # remove index RewriteRule (.*)index$ $1 R=301 # remove slash if not directory RewriteCond %{REQUEST_FILENAME}!

-d RewriteCond %{REQUEST_URI} /$ RewriteRule (.*)/ $1 R=301 # add . Php to access file, but don't redirect RewriteCond %{REQUEST_FILENAME}. Php -f RewriteCond %{REQUEST_URI}!

/$ RewriteRule (.*) $1\. Php L.

I got this from a rather helpful chap on a forum once - never fully understood it, and there is one caveat; it implies no trailing slash unless the request is a directory. However, I thought it was worth posting - a guru out there may easily spot the fix!? # remove .

Php; use THE_REQUEST to prevent infinite loops RewriteCond %{HTTP_HOST} ^www\. Domain\. Com RewriteCond %{THE_REQUEST} ^GET\ (.*)\.

Php\ HTTP RewriteRule (.*)\. Php$ $1 R=301 # remove index RewriteRule (.*)index$ $1 R=301 # remove slash if not directory RewriteCond %{REQUEST_FILENAME}! -d RewriteCond %{REQUEST_URI} /$ RewriteRule (.*)/ $1 R=301 # add .

Php to access file, but don't redirect RewriteCond %{REQUEST_FILENAME}. Php -f RewriteCond %{REQUEST_URI}! /$ RewriteRule (.*) $1\.

Php L.

Thank you! I'll give this a go and see what we can figure out.. any gurus care to add to/adjust this to include a trailing slash to all requests? – revive Jun 12 '10 at 13:45 FINALLY, an answer that works.

I searched high and low. One note, I had to add "RewriteBase /" to the beginning because my files are nested in other folders that go below the domain, and it was routing them to lower levels, which showed up in the URL. = no good.

– American Yak Jul 18 '10 at 22:10.

You can try this in your htaccess file: Options +MultiViews But it depends on wheter it is enabled by your webserver. Also, do note that htaccess files are specific to Apache webservers, so it won't work if you're using something else.

– Marco Demaio May 19 at 11:30 @Marco Demaio: actually... I mostly use Nginx these days. Apache has some advantages but usually you don't need all those features. – WoLpH May 19 at 22:30.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions