Reputation: 17
How do I redirect from .html/ to .html ?
I redirected my old Blog Directory to the News Directory but it does it with a Slash at the end after .html
I tried those two lines in my .htaccess file but it did nothing...
RewriteRule (.*\.html)/$ $1 [R=301,L]
RewriteRule (.*\.html)/$ $1 [R,L]
Upvotes: 0
Views: 186
Reputation: 171
You need this below your RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R] # <- for test, for prod use [L,R=301]
or
RewriteRule .*\.html\/$ $1 [R=301,L]
or
RewriteRule (.*)\.html\/$ http:\/\/www.example.com$1.html [R=301,L]
or
RewriteRule ^(.+)\.html\/$ $1.html [R=301,L]
Upvotes: 1
Reputation: 17
I found the answer to my problem:
You need this below your RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R] # <- for test, for prod use [L,R=301]
Upvotes: 1