0

I need a mod rewrite 301 that remove a slash behind the .html from the url.

Example:

Good URL: http://www.example.org/some-stuff-t123.html Bad URL: http://www.example.org/some-stuff-t123.html/abcdesftesttest

The Bad URL with a / after the html should rewrited (301) to the good URL.

I need a request URI that detect a /* after the html and if yes, rewrite it.

Thank you

1 Answer 1

0

Try:

RedirectMatch 301 ^/(.*)\.html/ /$1.html

or using mod_rewrite:

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

If you have other rewrite rules, make sure the one that redirects is before any rules you may already have.

2
  • thank you so much. Both suggestions works perfect. which one should I take? which one you prefer?
    – labu77
    Commented May 17, 2013 at 16:01
  • @user2057781 it doesn't matter, but if you have other rewrite rules, it may conflict with mod_alias' RedirectMatch. Otherwise, it doesn't matter.
    – Jon Lin
    Commented May 17, 2013 at 16:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.