Jump to content

How to redirect entire directory to one page


longtone

Recommended Posts

I want to redirect all pages a directory to one page outside that directory eg:

 

/folder/somepage.php

 

to

 

/anotherpage.php

 

and ideally add a query string:

 

/folder/somepage.php

 

to

 

/anotherpage.php?sv=somepage

 

I thought this would do it:

Redirect /folder/([a-zA-Z0-9]+)$ http://www.example.com/anotherpage.php?sv=$1

 

but it doesn't...

 

Can anyone see what I'm doing wrong?

 

 

You're right, I was confusing the two

Actually what I ended up doing was both:

Redirect /folder/ http://www.example/anotherpage/
RewriteRule    ^anotherpage/([a-zA-Z0-9]+)?$  anotherpage.php?sv=$1 

which gives the new url in the address bar but without the query string

 

Thanks

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.