Apache Rewrite Query

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 ...


Go Back   Usenet Forums > Web Server and Related Forums > Linux Web Servers

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 07-01-2005
Chris
 
Posts: n/a
Default Apache Rewrite Query

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.
  #2 (permalink)  
Old 07-02-2005
Tim
 
Posts: n/a
Default Re: Apache Rewrite Query

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.
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 06:53 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0