Submit Your Article Forum Rules

Results 1 to 8 of 8

Thread: Mod_Rewite Problem

  1. #1
    Junior Member
    Join Date
    Sep 2011
    Posts
    0

    Mod_Rewite Problem

    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

  2. #2
    Member
    Join Date
    Aug 2011
    Location
    Dallas, Texas
    Posts
    36
    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

  3. #3
    Member
    Join Date
    Aug 2011
    Location
    Dallas, Texas
    Posts
    36
    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...
    A wise equation: Unique content is king + a unique idea = Great Search Engine Rankings!
    Dallas web design Branding and Identity Social Media Management

  4. #4
    Junior Member
    Join Date
    Sep 2011
    Posts
    0
    Thank you for the code. The first one had no effect. I have to figure out where to put the 2nd one.

  5. #5
    Rest in Peace 1946 - 2013 deepsand's Avatar
    Join Date
    May 2004
    Location
    State College, PA
    Posts
    16,376
    Quote Originally Posted by Mike66nMD View Post
    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..

  6. #6
    Junior Member
    Join Date
    Sep 2011
    Posts
    0
    Yes the entire cart is PHP .. aka X-CART and we use a mod to change all the php extensions to HTML for SEO.

  7. #7
    Member
    Join Date
    Aug 2011
    Location
    Dallas, Texas
    Posts
    36
    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...
    A wise equation: Unique content is king + a unique idea = Great Search Engine Rankings!
    Dallas web design Branding and Identity Social Media Management

  8. #8
    Junior Member
    Join Date
    Sep 2011
    Posts
    0
    Didnt work in index.php, have to look more. Thank you for your info : )

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •