httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From janus76 <janus7...@gmail.com>
Subject Re: [users@httpd] 301 redirects
Date Tue, 14 Jul 2009 09:51:35 GMT

Thanks for your advise.

i think it will be easier to put this directly into the httpd.conf file at
the end, then they are all in one place.

if have had a play with the query string and come up with the following
which works.
RewriteEngine on
RewriteCond %{QUERY_STRING} id=(99)
RewriteRule ^/oldsite1/?index\.php$ http://www.newdomain/newsite/page1?
[R=301,L]

where the original url is
www.olddomain/oldsite1/index.php?id=99

and this is then redirected to
www.newdomain/newsite/page1

the question mark at the end of the RewriteRule ensures the id number is not
included in the new url.

I hopefully won't have too many of these to do, but this will come in very
useful

once again, thanks for pointing me in the right direction

all the best

Janus



awarnier wrote:
> 
> janus76 wrote:
> ...
>   so i
>> thought a htaccess file would be a simple way to manage and keep some of
>> the
>> old links working (by redirecting)
>> 
>> Am I going about this wrong way? is there a different way?
>> 
> Doing rewrites in a .htaccess file is not the most efficient way, if you 
> have access to the server configuration.
> By doing a rewrite in a .htaccess file, you basically force Apache to 
> completely resolve the path to the directory a first time, then throw 
> everything away and start all over again.  For each access.
> 
> Put your rewrite rules in the server (or VHost) configuration if you 
> can.  Use .htaccess only if you are not allowed to modify the server 
> config files.
> 
> In addition, in your case I don't think it even makes sense to put them 
> in .htaccess, because it means your new server will have to duplicate 
> the file structure of the old one, just to put a .htaccess in each of 
> the old directories to send it somewhere else.
> 
> About picking up data from what is after the "?" in your URL : that is 
> part of the QUERY_STRING, not really of the URL.  You need to do 
> something special for that. Check the on-line mod_rewrite documentation.
> It is specially mentioned there.
> 
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/301-redirects-tp24463434p24476558.html
Sent from the Apache HTTP Server - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message