Roy Peleg
Roy Peleg

Reputation: 1030

how to htaccess redirect *.html/ to *.html

Can someone help me add the right line to htaccess that will redirect URLs that end with .html/

to

.html

For example, http://mysite.com/page.html/ should 301 redirect to http://mysite.com/page.html

Upvotes: 0

Views: 105

Answers (2)

Philip Wigg
Philip Wigg

Reputation: 84

So how about this?

RewriteEngine On
RewriteRule (.*\.html)/$ $1 [R=301,L]

This does redirect users with a 301.

Upvotes: 0

poncha
poncha

Reputation: 7866

If You want a single canonical version, why not say so in your document?

<link rel="canonical" href="http://www.example.com/page.html" />

If you do however feel the need to do redirects, then you can use this:

RewriteEngine On
RewriteRule (.*\.html)/$ $1 [R,L]

Upvotes: 1

Related Questions