Omzy Posted February 12, 2010 Share Posted February 12, 2010 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 More sharing options...
cags Posted February 13, 2010 Share Posted February 13, 2010 Try... RewriteCond %{REQUEST_FILENAME} \.php -f RewriteRule ^(.*)\.php/? /$1.php Link to comment https://forums.phpfreaks.com/topic/191924-rewrite-rule-for-no-page-extension/#findComment-1011601 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.