Jump to content

rewrite rule for no page extension


Omzy

Recommended Posts

I'm basically after the rewrite rules to omit the .php extension of the URL, with and without the trailing slash, so for example:

 

localhost/page should redirect to localhost/page/

 

localhost/page/ should redirect to localhost/page.php

 

Currently I have this code:

 

RewriteCond %{REQUEST_FILENAME}\.php -f

RewriteRule ^(.*)$ $1.php

RewriteRule ^(.*)/$ $1.php

 

It does not seem to work for the URL with the trailing slash.

Link to comment
https://forums.phpfreaks.com/topic/191924-rewrite-rule-for-no-page-extension/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.