Forum Moderators: phranque

Message Too Old, No Replies

how to redirect entire directory tree to a single page

         

cpcpy

3:49 am on May 6, 2005 (gmt 0)

10+ Year Member



hi,

how do i redirect all pages under a directory (eg old) to a single page...

ie
www.mydomain.com/old/and/all/files/here ==> www.mydomain.com/new/old-folder-do-not-exist-anymore.html

tried redirectpermanent but it doesn't seem to work...

thanks

sitz

4:02 am on May 6, 2005 (gmt 0)

10+ Year Member



Define "doesn't work"; does it redirect you to the wrong place? Does it fail to redirect you at all? Does the computer rip off its pants and dance around the coldroom eating a popsicle? It's all in details. =)

cpcpy

4:25 am on May 6, 2005 (gmt 0)

10+ Year Member



apologies :)

this is how it didn't work...

my .htaccess file
================================
redirectPermanent /old [mydomain.com...]
================================

[1]
[mydomain.com...] ==> [mydomain.com...] [OK]

[2]
[mydomain.com...] ==> [mydomain.com...] [OK]

but what i want is for any page under /old
eg
[mydomain.com...]
[mydomain.com...]
[mydomain.com...]
[mydomain.com...]

to be redirected to a particular HTML page
eg [mydomain.com...]

thanks

sitz

1:30 pm on May 6, 2005 (gmt 0)

10+ Year Member



Because the docs at [httpd.apache.org ] state:
The Redirect directive maps an old URL into a new one. [snip] ...any requests for documents beginning with this path will be returned a redirect error to a new (%-encoded) URL beginning with URL.

Example:

Redirect /service [foo2.bar.com...]

If the client requests [myserver...] it will be told to access [foo2.bar.com...] instead.

Sounds like what you need is RedirectMatch [httpd.apache.org]