![]() |
Help with adding trailing slash to URL (.htaccess)
So I have been able to hide the .html extension on my pages, but I can't seem to get the trailing slash working. I've tried multiple codes with no luck. Here is how I configured my .html extension removal in .htaccess:
#force www RewriteCond %{HTTP_HOST} !^www\. RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] # remove .html ONLY if requested directly RewriteCond %{THE_REQUEST} (\.html\sHTTP/1) RewriteRule ^(.+)\.html$ /$1 [R=301,L,QSA] # remove trailing slash ONLY if it is not an existing folder RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)/$ /$1 [L,R=301] # rewrite to FILENAME.html if such file does exist and is not a folder RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.html -f RewriteRule ^(.*)$ /$1.html [L,QSA] |
Code:
.php with the extension you want to hideCode:
RewriteCond %{REQUEST_FILENAME} !-fyou will need to reference your target directory for this to work properly |
I tried using the above codes, No change happened... Most of my website is in the same root directory, except for my blog so for the last line of your code I just tried:
Quote:
What am I missing? I also changed the .php to .html like you said |
| All times are GMT +1. The time now is 07:12 AM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.