Domain Manage

Any .htaccess wizards out there ?

Discussion in 'SEO Search Engine Optimisation' started by LumpyBumps, Nov 7, 2010.

Thread Status:
Not open for further replies.
  1. LumpyBumps

    LumpyBumps Member

    Joined:
    May 2007
    Posts:
    43
    Likes Received:
    2
    Does anyone know how to write the htaccess rule so that urls containing parameters can be redirected to the root url ?

    In other words I want to redirect:

    index.php?blah=fred&bob=joe

    to:

    index.php only ?

    This is to stop Google indexing multiple versions of the same page (loooong story !)

    Cheers

    Phil
     
  2. Domain Forum

    Acorn Domains Elite Member

    Joined:
    1999
    Messages:
    Many
    Likes Received:
    Lots
     
  3. osxkris

    osxkris Member

    Joined:
    Jan 2009
    Posts:
    15
    Likes Received:
    4
    I haven't tested this, but something like the following should do the trick:

    RewriteRule ^index\.php\?.+$ index.php [R=301]
     
  4. Ashton United Kingdom

    Ashton Well-Known Member

    Joined:
    Feb 2010
    Posts:
    1,621
    Likes Received:
    29
    Last edited: Nov 7, 2010
  5. LumpyBumps

    LumpyBumps Member

    Joined:
    May 2007
    Posts:
    43
    Likes Received:
    2
    Nope, it didn't work I'm afraid. The test url index.php?blah=fred remains in the address bar. That's as far as I managed to get myself.

    Any ideas ?

    Phil
     
  6. retired_member21

    retired_member21 Retired Member

    Joined:
    Apr 2008
    Posts:
    742
    Likes Received:
    13
  7. LumpyBumps

    LumpyBumps Member

    Joined:
    May 2007
    Posts:
    43
    Likes Received:
    2
    Thanks Nick, can't quite get my head around that but I think that it's close to what I want. Maybe after some food I'll figure it out !

    @Ashton: thanks for the tip. Not sure that it's applicable in this instance but I'll definately use that to ensure that inbound links to different versions of the domain are treated correctly.
     
  8. mat United Kingdom

    mat Well-Known Member

    Joined:
    Apr 2007
    Posts:
    3,782
    Likes Received:
    73
    How about something like this?

    RewriteCond %{QUERY_STRING} ^id=([0-9]*)$
    RewriteRule ^index\.php$ /index.php? [R=301]
     
Thread Status:
Not open for further replies.

Share This Page