View Full Version : Mod_Rewite Problem
Mike66nMD
09-23-2011, 08:55 PM
Please forgive me if I am posting in the wrong thread.
I have links coming in from another site that are formatted with a &partner=xxx at the end of the URL
Where xxx = there name
I don't have an affliate program but ....
I am trying all combinations of Mod_Redirect but not getting the right results.
RewriteCond %{QUERY_STRING} ^partner=.*$
RewriteRule ^(.*)$ http ://domain1? [R=301,L]
Trying to remove everything after & including the & sign.
Anyone see a problem with the above ?
Thank you in advance
Mike
AciveLite2k
09-29-2011, 02:24 PM
Try the following:
RewriteEngine on
Options FollowSymlinks
RewriteBase /
RewriteRule ^index.php?yourvar1=(.*)&partner=xxx$ /index.php?yourvar1=$1 [T=application/x-httpd-php]
Hope this helps
AciveLite2k
09-29-2011, 05:27 PM
Another idea is to not use .htaccess and use PHP to do the actual Redirects?
ie
<?
if (isset($_REQUEST['partner']) {
header ('HTTP/1.1 301 Moved Permanently');
header('Location: http://www.example.com/?yourvar1='. $_REQUEST['yourvar1_answer']);
}
?>
The above if you modify, it will redirect everyone to the page without the $partner var...
Mike66nMD
09-29-2011, 09:01 PM
Thank you for the code. The first one had no effect. I have to figure out where to put the 2nd one.
deepsand
09-29-2011, 09:07 PM
Thank you for the code. The first one had no effect. I have to figure out where to put the 2nd one.
Are you running PHP? If not, the 2nd will no work.
Which types of redirect mechanisms are available and best for the circumstance depends on both the web server being used as well as any special platforms/environments such as .ASP, PHP, etc..
Mike66nMD
09-29-2011, 09:26 PM
Yes the entire cart is PHP .. aka X-CART and we use a mod to change all the php extensions to HTML for SEO.
AciveLite2k
09-29-2011, 09:31 PM
In that case option 2 would work, because x-cart is very dynamic, you can adjust the code to grab the URL, remove &partner=xxx then redirect... This way you could insert the code directly into index.php...
Mike66nMD
09-29-2011, 09:52 PM
Didnt work in index.php, have to look more. Thank you for your info : )