.htaccess redirection

Hi.

I am trying to set a redirection to a section in a website through .htacess and having a problem.

The web would be, for example:

www. thesiteweb . com

And I am trying to redirect from

www. thesiteweb . com/section

to

www. thesiteweb . com/page-not-found

Then I set this:

Redirect 302 /section http://www. thesiteweb . com/page-not-found

The problem is that there are different pages in the section is also a directory with many pages, so such redirection works also with

www. thesiteweb . com/section/a
www. thesiteweb . com/section/b
www. thesiteweb . com/section/c

or

www. thesiteweb . com/section/whaterver-other-page

So any page in the directory is blocked by redirection to page-not-found.

Obviously, www. thesiteweb . com/section is www. thesiteweb . com/section/index.php, but this other option does not work either:

Redirect 302 /section/index.php http://www. thesiteweb . com/page-not-found

For the same reason.

Is there anyway to resctrict the redirection just to the root and not to the files in the folder?

Thanks very much.

Redirect match should do the trick.

RedirectMatch 302 ^/section$ http://www. thesiteweb . com/page-not-found

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.