Forum Moderators: phranque

Message Too Old, No Replies

Help needed with redirects - Please help me

         

Doublehelix

2:26 pm on Jul 21, 2010 (gmt 0)

10+ Year Member


Hi

Could someone please help with as i need to redirect a dynamic domain to another dynamic domain and i can't get it to work

Here are some examples of domains i am trying to redirect: -

From:
domain.com/catalog/default.php?cPath=67_21_4913

To:
newdomain.com/index.php?app=gbu0&ns=catshow&ref=4913

if someone could help me out that would be great

jdMorgan

6:38 am on Jul 23, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In your domain.com/.htaccess file:

RewriteCond %{QUERY_STRING} ^cPath=67_21_4913$
RewriteRule ^catalog/default\.php http://newdomain.com/index.php?app=gbu0&ns=catshow&ref=4913 [R=301,L]

This assumes that you've already got other mod_rewrite rules in place, and therefore that you have already enabled mod_rewrite and the rewriting engine.

See the resources cited in our Apache Forum Library for more information (link at the top of this page).

Jim

Doublehelix

8:17 am on Jul 23, 2010 (gmt 0)

10+ Year Member



Hi jdMorgan

That's is great and works perfectly

thank you very much for that , my head was battered trying to get it working

Doublehelix

9:47 am on Jul 23, 2010 (gmt 0)

10+ Year Member


Hi I have come across another issue as the products have more information in the URL's

for example the url is domain.net/catalog/product_info.php?cPath=67_23_437_439&products_id=1215

this needs to forward to newdomain.com/index.php?app=gbu0&ns=prodshow&ref=1215

do i need more queries for the redirect to work?

Cheers

jdMorgan

5:54 pm on Jul 23, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



No. If the query string always starts with "cPath=" but may or may not have additional parameters appended, just change the query string pattern:

RewriteCond %{QUERY_STRING} ^cPath=67_21_4913(&.*)?$

Please see the regular expressions documentation cited in our forum charter. While we're happy to provide examples here, it's up to you to modify those examples to suit your exact needs... :)

There are solutions for many, many variations of URL- and query-string formats. But it would be impossible to post more than a few of the thousaands of potential solutions. Therefore, asking about *exactly* what you need is critical, because the code must be exact.

Jim

Doublehelix

9:40 am on Jul 26, 2010 (gmt 0)

10+ Year Member



Hi Jim


That has been a great help, this works like a charm.

many thanks for all your help with this issue

Doublehelix