1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Need redirect from domain.com/index.php to domain.com

Discussion in 'Search Engine Optimization' started by deadlychaos25, May 18, 2008.

  1. #1
    Hi

    I just seen that many people are recommending that there should not be 2 same pages on different names like domain.com/index.php and domain.com
    So i want to redirect my domain.com/index.php to domain.com
    Anyone please give me a redirect which i can add in .htaccess

    Thanks in advance !!
     
    If someone posts a solution, use the "Best Answer" link in their post to pick it as the best answer.
    deadlychaos25, May 18, 2008 IP
  2. deadlychaos25

    deadlychaos25 Guest

    Best Answers:
    0
    #2
    No one wants to help :(
     
  3. astup1didiot

    astup1didiot Notable Member

    Messages:
    5,926
    Likes Received:
    270
    Best Answers:
    0
    Trophy Points:
    280
    #3
    
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php HTTP/             
    RewriteRule ^index\.php$ http://www.yourdomain.com/ [R=301,L]         
    
    Code (markup):
    enjoy
     
    LawnchairLarry likes this.
  4. deadlychaos25

    deadlychaos25 Guest

    Best Answers:
    0
    #4
    thanks for that but its not working
    may be because my prior .htaccess data

    here is the text which is in my .htaccess

    RewriteEngine On
    RewriteRule ^((urllist|sitemap).*\.(xml|txt)(\.gz)?)$ vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 [L]
    
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^domain\.com$ [NC]
    RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]
    Code (markup):
    I just added your code but its giving 500 internal error
    please help

    Thank you again :)
     
  5. astup1didiot

    astup1didiot Notable Member

    Messages:
    5,926
    Likes Received:
    270
    Best Answers:
    0
    Trophy Points:
    280
    #5
    Replace domain.com with your actual domain name silly.
     
  6. deadlychaos25

    deadlychaos25 Guest

    Best Answers:
    0
    #6
    Bro i don't want to show my site here thats why i renamed to domain.com
    this does not work - try it yourself
    now who's silly :p
     
  7. astup1didiot

    astup1didiot Notable Member

    Messages:
    5,926
    Likes Received:
    270
    Best Answers:
    0
    Trophy Points:
    280
    #7
    Works fine on all 12 of my websites, what does your apache log declare when its called?
     
  8. deadlychaos25

    deadlychaos25 Guest

    Best Answers:
    0
    #8
    Ok let me show you how is my .htaccess file

    RewriteEngine On
    RewriteRule ^((urllist|sitemap).*\.(xml|txt)(\.gz)?)$ vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 [L]
    
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^domain\.com$ [NC]
    RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]
    
    
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php HTTP/             
    RewriteRule ^index\.php$ http://www.domain.com/ [R=301,L]
    Code (markup):
    1st line is of my sitemap
    2nd is of redirecting my URL to www version
    and 3rd one is the one you gave me

    Is this in a correct manner ?

    My apache showed 500 internal error
    I think i am going wrong with the proper format of this rewrite rule

    Thanks for your help till now :)
     
  9. astup1didiot

    astup1didiot Notable Member

    Messages:
    5,926
    Likes Received:
    270
    Best Answers:
    0
    Trophy Points:
    280
    #9
    Just PM me the site URL and all this code; I'll format it properly for your site URL so it's correct.
     
  10. deadlychaos25

    deadlychaos25 Guest

    Best Answers:
    0
    #10
    PM send - eagerly waiting for your reply :)
     
  11. redz

    redz Well-Known Member

    Messages:
    3,095
    Likes Received:
    114
    Best Answers:
    0
    Trophy Points:
    105
    #11
    do you have cpanel? because if you do you can just do it there by clicking redirects.
     
    redz, May 19, 2008 Set Best Answer IP
  12. deadlychaos25

    deadlychaos25 Guest

    Best Answers:
    0
    #12
    This can be a good idea
    I will try this and get back to you
    Thanks...:)