Forum Moderators: phranque

Message Too Old, No Replies

Mod Rewrite

Permanent 301

         

gosman

3:42 pm on Jan 5, 2006 (gmt 0)

10+ Year Member



I need to do a permanent 301 for some urls

[mysite.dom...]

To

[mysite.dom...]

Any help would be much appreciated.

jdMorgan

5:07 pm on Jan 5, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This search [google.com] should help you focus your question a little, and a quick read of our forum charter may be useful in getting the most out of this forum. It also contains some link to reference material on mod_rewrite and regular expressions, needed to solve your problem.

Jim

gosman

5:17 pm on Jan 5, 2006 (gmt 0)

10+ Year Member



Hi JDMorgan

I have been trying to solve this problem for the last 2 days. I have read through most of these articles but can't seem to figure it out. I have been playing around with the .htaccess and have managed to redirect in various ways but can't seem to solve this one. Hence the reason for my post.

gosman

6:33 pm on Jan 5, 2006 (gmt 0)

10+ Year Member



OK nearly there. I've managed to rewrite using the following.

Options +FollowSymlinks
RewriteEngine On

rewriteCond %{query_string} pageName=Info&id=1234&prodID=xyz
rewriterule ^index\.jsp$ [mysite.dom...] [R=301,L]

However prodID=xyz is a variable, can anybody advise on how I pass xyz from the query_string to rewriterule.

jdMorgan

1:59 pm on Jan 6, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sure, see the term 'back-references' in the documentation:

Options +FollowSymlinks
RewriteEngine on
#
RewriteCond %{QUERY_STRING} pageName=Info&id=1234&prodID=([^&]+)
RewriteRule ^index\.jsp$ http://www.example.com/search.php?hd_request=20&prodId=%1 [R=301,L]

Jim

gosman

2:30 pm on Jan 6, 2006 (gmt 0)

10+ Year Member



That's the one.

Thanks Jim.

1 question will doing a redirect in this way preseve the pagerank of the current page.

BillyS

8:22 pm on Jan 6, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



>>1 question will doing a redirect in this way preseve the pagerank of the current page.

It should but only Google knows for sure.