This forum has been moved here:
Helicon Tech Community Forum

ISAPI_Rewrite 3.0 (Forum Locked Forum Locked)
 Helicon Tech : ISAPI_Rewrite 3.0
Subject Topic: 301 Redirect for multiple subdirectories
Author
Message |
rogerbuehler
Newbie


Joined: 25 November 2011
Posts: 2
Posted: 25 November 2011 at 2:41am

Hello everybody

I have the foolowing redirect I want to do:

Old URL: www.test.com/areas/subdirectory
New URL www.test2.com/new/
subdirectory

So, the subdirectory remains, I just want to replace www.test.com/areas/ with www.test2.com/new/
The Redirect should be permanent (301).
I have lots of subdirectories (
www.test.com/areas/subdirectory, www.test.com/areas/subdirectory1, www.test.com/areas/subdirectory2.....). So it would be cool to have only one rewriterule which handles all subdirectories. Is that possible?

Thanks for your help. Best regards

Roger
Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 28 November 2011 at 6:04am

Hello Roger,

Try using the following:

Code:
RewriteEngine on
RewriteBase /

RewriteCond %{HTTP:Host} ^www\.test\.com$ [NC]
RewriteRule ^areas/(.+)$ http://www.test2.com/new/subdirectory/$1 [NC,R=301,L]


Regards
Andrew
Back to Top
 
rogerbuehler
Newbie


Joined: 25 November 2011
Posts: 2
Posted: 29 November 2011 at 10:06am

Hi Andrew

Thanks a lot for your response. It was not working like
that, I fixed it, the correct code is the following:

RewriteCond %{HTTP:Host} ^www\.test\.com$ [NC]
RewriteRule ^/areas/(.+)$ http://www.test2.com/new/$1
[NC,R=301,L]

Like this all subdirectories will be redirected
automatically.

Best regards
Roger
Back to Top
 

Sorry, you can NOT post a reply.
This forum has been locked by a forum administrator.

Printable version Printable version