301 redirect with .htaccess - quick help needed:

Discussion in 'Apache' started by DomainMagia, Jul 14, 2008.

  1. #1
    Hi,

    A little help from Apache gurus here would be much appreciated. My CMS produces URL-s like

    mydomain.com/?lang=1
    mydomain.com/index.php?lang=1
    myaliasdomain.com/?lang=1
    myaliasdomain.com/index.php?lang=1

    I need to forward all of them to homepage mydomain.com/
    My .htaccess includes following code

    RewriteCond %{THE_REQUEST} lang=1
    RewriteRule . http: // www. mydomain. com? [R=301,L]

    it works perfectly for

    mydomain.com/index.php?lang=1
    myaliasdomain.com/index.php?lang=1

    but does not redirect URL without index.php in it. What code should I use to redirect mydomain.com/?lang=1 and myaliasdomain.com/?lang=1?

    Thanks a lot!
     
    DomainMagia, Jul 14, 2008 IP
  2. DomainMagia

    DomainMagia Peon

    Messages:
    125
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Bump! Anyone knows? How should I insert redirect for URL like mydomain.com/?lang=1?
     
    DomainMagia, Jul 15, 2008 IP
  3. DomainMagia

    DomainMagia Peon

    Messages:
    125
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Tried many RewriteCond and RewriteRule variations but still didn`t find solution that works. If anyone knows how to redirect

    mydomain.com/?lang=1 to mydomain.com/

    any help would be much appreciated.

    Thanks!
     
    DomainMagia, Jul 18, 2008 IP