Redirection when no query string

Discussion in 'Apache' started by agriz, Jul 3, 2010.

  1. #1
    Hi,

    I want to redirect my website index.php to domain
    example.com/index.php to example.com

    My site mostly use index.php?dll=register, index.php?dll=login.

    So it should redirect only when there is no query string.
    And, if i login, it will go to index.php again with form fields posted.

    So, it should not redirect if there is form post.

    Is that possible?
    Please let me know how to do this if possible.

    I did something like this which is not working.

    #RewriteEngine on
    #Options +FollowSymLinks
    #RewriteCond %{THE_REQUEST} ^.*/index\.php
    #RewriteRule ^(.*)index.php(.*)$ http://www.site.com/$2 [R=301,L]

    Regards
    Mahesh
     
    agriz, Jul 3, 2010 IP
  2. Imran

    Imran Notable Member

    Messages:
    2,340
    Likes Received:
    190
    Best Answers:
    0
    Trophy Points:
    230
    #2
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
    RewriteRule ^index\.php$ http://www.digitalseo.info/ [R=301,L]

    I have done this long back Hope this will help you, let me know..
     
    Imran, Jul 5, 2010 IP