Re: 301 redirects

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxx
>    "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
> For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx
> 
> 
> 

-- 
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@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux