Frazer Kirkman (frazer) wrote in apache,
Frazer Kirkman
frazer
apache

Redirect Match

Hello,

i would like to do this:

RedirectMatch 301 (.*)\.html$ $1
RedirectMatch 301 (.*)\.htm$ $1


but not to files in sub folders.

could some one please tell me how to do it?

thank you
Subscribe
  • Post a new comment

    Error

    default userpic

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 3 comments

I believe this:

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

should cover both your rules. It matches any URL-path that starts with / (as all do), but otherwise doesn't contain /, and ends with .html or .htm.

thank you, works perfectly
You're welcome. :-)