1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How To Redirect index.php To Root Dir?

Discussion in 'White Hat SEO' started by Dark Knight, Jun 26, 2010.

  1. Dark Knight

    Dark Knight Jr. VIP Jr. VIP Premium Member

    Joined:
    Nov 15, 2009
    Messages:
    731
    Likes Received:
    1,194
    Hey,
    How to redirect
    mydomain.com/index.php
    mydomain.com/#
    To
    mydomain.com
    using .htaccess

    I know using like

    RewriteEngine on

    #Options FollowSymlinks

    rewritecond %{http_host} ^mydomin.com [nc]

    rewriterule ^(.*)$ http://www.mydomin.com/$1 [r=301,nc]

    :confused:
    but i don't know how to add above my problem to htaccess
    Thanks
     
  2. summertime1

    summertime1 Junior Member

    Joined:
    Jun 11, 2010
    Messages:
    130
    Likes Received:
    22
    Code:
    RewriteRule ^index\.php$ / [r=301,nc] 
    The / identifies your domain
     
    • Thanks Thanks x 1
  3. Dark Knight

    Dark Knight Jr. VIP Jr. VIP Premium Member

    Joined:
    Nov 15, 2009
    Messages:
    731
    Likes Received:
    1,194
    So it would be something like this

    RewriteEngine on

    #Options FollowSymlinks

    rewritecond %{http_host} ^mydomin.com [nc]

    rewriterule ^(.*)$ http://www.mydomin.com/$1 [r=301,nc]


    RewriteRule ^index\.php$ / [r=301,nc]

    rewriterule ^(.*)$ http://www.mydomin.com/$1 [r=301,nc]

    RewriteRule ^index\.php$ / [r=301,nc]

    rewriterule ^(.*)$ http://www.mydomin.com/$1 [r=301,nc]


    Am I right


     
  4. Dark Knight

    Dark Knight Jr. VIP Jr. VIP Premium Member

    Joined:
    Nov 15, 2009
    Messages:
    731
    Likes Received:
    1,194

    Ouch I tried that but doesn't work

    :bump:
     
  5. summertime1

    summertime1 Junior Member

    Joined:
    Jun 11, 2010
    Messages:
    130
    Likes Received:
    22
    try only this:

    Code:
    RewriteEngine on
    
    #Options FollowSymlinks
    
    rewritecond %{http_host} ^mydomin.com [nc]
    
    rewriterule ^(.*)$ http://www.mydomin.com/$1 [r=301,nc]
    
    RewriteRule ^index\.php$ / [r=301,nc]
    maybe replace / by http://www.mydomain.com
     
    • Thanks Thanks x 1
  6. Dark Knight

    Dark Knight Jr. VIP Jr. VIP Premium Member

    Joined:
    Nov 15, 2009
    Messages:
    731
    Likes Received:
    1,194
    Thanks its working now