Help with simple redirect for part of site

 
Post new topic   Reply to topic    Aprelium Forum Index -> URL Rewriting
View previous topic :: View next topic  
Author Message
mscdex
-


Joined: 12 Dec 2004
Posts: 3

PostPosted: Tue Mar 20, 2007 10:05 pm    Post subject: Help with simple redirect for part of site Reply with quote

I recently found out that some users that have bookmarked my site have the old address saved, and not the new one. How can I set a url rewrite for an entire directory and all requests for files/directories below that directory to point to a new url?

For example:

Users who navigate to say either:
http://www.example.com/site/
or
http://www.example.com/site/files/
or even
http://www.example.com/site/files/fubar.zip

should be redirected to:
http://www.example.com/newsite/
Back to top View user's profile Send private message
hc2995
-


Joined: 07 Aug 2006
Posts: 644
Location: Maryland, USA

PostPosted: Tue Mar 20, 2007 11:17 pm    Post subject: Reply with quote

ou could just put up an HTML page saying we moved to BLAH, thats what i do when i move sites, most users will understand and bookmark the new site
_________________
Where have i been? School got heck-tick, had to move half way around the state, then back... and then i had to change jobs, so iv been away for a while :P
Back to top View user's profile Send private message AIM Address
AbyssUnderground
-


Joined: 31 Dec 2004
Posts: 3855

PostPosted: Tue Mar 20, 2007 11:58 pm    Post subject: Reply with quote

Make your error 404 page tell them the resource may have moved and to go to the homepage. That could be a temporary solution until you get the url rewriting working.
_________________
Andy (AbyssUnderground) (previously The Inquisitor)
www.abyssunderground.co.uk
Back to top View user's profile Send private message Visit poster's website
mscdex
-


Joined: 12 Dec 2004
Posts: 3

PostPosted: Tue Mar 20, 2007 11:59 pm    Post subject: Reply with quote

hc2995 wrote:
ou could just put up an HTML page saying we moved to BLAH, thats what i do when i move sites, most users will understand and bookmark the new site


The problem with that is, I'd have to put an html in every single folder under that main folder where my old site resided. I had several hundred folders previously, and that would quite a bit of time to put one in every single folder there. I was hoping there was a more elegant solution anyway with the url rewriting.


AbyssUnderground wrote:
Make your error 404 page tell them the resource may have moved and to go to the homepage. That could be a temporary solution until you get the url rewriting working.


I could do that, but I host multiple sites on my web server machine. So if a 404 came up while browsing one of the other sites it would confuse and misdirect the user.
Back to top View user's profile Send private message
AbyssUnderground
-


Joined: 31 Dec 2004
Posts: 3855

PostPosted: Wed Mar 21, 2007 12:09 am    Post subject: Reply with quote

If you're using X2 and set up a new VHOST for each site then you can set 404 pages independantly of each website.
_________________
Andy (AbyssUnderground) (previously The Inquisitor)
www.abyssunderground.co.uk
Back to top View user's profile Send private message Visit poster's website
TRUSTAbyss
-


Joined: 29 Oct 2003
Posts: 3752
Location: USA, GA

PostPosted: Wed Mar 21, 2007 12:11 am    Post subject: Reply with quote

Try this Rewrite Rule:

Virtual Path Regular Expression: ^/site/(.*)$

If this rule matches: Perform an external redirection
Redirect to: /newsite/$1

Status Code: 301 - Moved Permanently
Back to top View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> URL Rewriting All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group