This is a discussion on Apache Rewrite Query within the Linux Web Servers forums, part of the Web Server and Related Forums category; Hi, I've moved a site from one location to another, and am using modRewrite to direct requests to the ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi,
I've moved a site from one location to another, and am using modRewrite to direct requests to the old address to the new one as follows: RewriteEngine On RewriteRule ^(.+) http://new.example.net/bounce/$1 [R,L] When I visit the old site http://old.example.org/bounce/ things work fine. If I visit it without the trailing slash (http://old.example.org/bounce), it tries to redirect to http://new.example.net/bounce//var/www/old/bounce - which doesn't exist. Would anyone be able to suggest how I could correct this? Many thanks. |
|
|||
|
On Fri, 01 Jul 2005 14:45:39 +0100,
Chris <write@~tochris~.~c0m~> posted: > I've moved a site from one location to another, and am using modRewrite > to direct requests to the old address to the new one as follows: > > RewriteEngine On > RewriteRule ^(.+) http://new.example.net/bounce/$1 [R,L] You'd really want to also set proper HTTP error response codes, too. Such as 301 (moved permanently) (use "R=301" instead of just "R"). I believe the default redirection is a "temporary" redirection instruction (at least my Apache manual says so). That way, any compliant robots will update their information to the new address (subsequent requests will be made directly to the new address, and the old address will eventually be ignored). Otherwise, they're forever accessing your old location, and should the old location become defunct they won't be accessing the new one, at all. See: <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html> > When I visit the old site http://old.example.org/bounce/ things work fine. > > If I visit it without the trailing slash > (http://old.example.org/bounce), it tries to redirect to > http://new.example.net/bounce//var/www/old/bounce - which doesn't exist. > > Would anyone be able to suggest how I could correct this? Another specific rule for the omitted slash, perhaps? Though it sounds odd. Doesn't the redirection have to be to a URI not file path? -- If you insist on e-mailing me, use the reply-to address (it's real but temporary). But please reply to the group, like you're supposed to. This message was sent without a virus, please delete some files yourself. |