Forum Moderators: phranque

Message Too Old, No Replies

All directory pages to the same new url

how do you rewrite this?

         

seoamstel

3:38 pm on Apr 10, 2006 (gmt 0)

10+ Year Member



Hi all,

I need to know a rewrite rule

I want to redirect all pages from a directory to a new url (the same for all redirected pages)

First I thought:

Redirect 301 /dir [newurl.com...]

but the problem withs this it is that it maintains the path, I dont want this

I want that
dir/a.htm, dir/b.htm , dir/c.htm.....all of them redirect to the same new url

Any help welcome

jdMorgan

12:27 am on Apr 11, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Redirect uses prefix-matching when deciding whether to redirect a request. If the requested URL matches the given prefix, then any remaing part of the requested URL that is not specified n that prefix is 'carried over' to the new URL.

Try using RedirectMatch [httpd.apache.org] instead.


RedirectMatch 301 ^/dir http://www.newurl.com/

Jim

heriana

11:03 am on Apr 11, 2006 (gmt 0)

10+ Year Member



I have a similar problem,

I see no difference between redirect and redirectmatch

when i use

RedirectMatch 301 ^/dir [newurl.com...]

and somebody is typing dir /whatever.html it redirects to www.newurl.com/whatever.html instead of just www.newurl.com

jdMorgan

3:27 pm on Apr 11, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Odd. It's not supposed to work like that. I suppose you could try:

RedirectMatch 301 ^/dir(.*)$ http://www.newurl.com/

Jim

seoamstel

12:59 pm on Apr 12, 2006 (gmt 0)

10+ Year Member



Thx Jim,

The second one solved the problem