index.html -> index.php 301 redirect question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • daveylapoo
    Confirmed User
    • Dec 2003
    • 423

    #1

    index.html -> index.php 301 redirect question

    I've got a nice SE placement in yahoo, but they've indexed the www.sitename.com/index.html url, and I am in the process of making the site dynamic so the new homepage url will be www.sitename.com/index.php.

    I was wondering how I could do a proper server side redirect using .htacess / 301 redirects as opposed to a meta refresh. I've googled different ways of doing it but none function properly.

    Thanks in advance to any who can help out!
  • ArsewithClass
    So Fucking Banned
    • Mar 2007
    • 7957

    #2
    Originally posted by daveylapoo
    I've got a nice SE placement in yahoo, but they've indexed the www.sitename.com/index.html url, and I am in the process of making the site dynamic so the new homepage url will be www.sitename.com/index.php.

    I was wondering how I could do a proper server side redirect using .htacess / 301 redirects as opposed to a meta refresh. I've googled different ways of doing it but none function properly.

    Thanks in advance to any who can help out!
    Could you not use the index with an enter here to link to a .php page!? I thought that most sites need a landing page thats pretty clean anyway. This way, nothing would change.

    Comment

    • fris
      Too lazy to set a custom title
      • Aug 2002
      • 55679

      #3
      or you could use modrewrite so you could alias index.html as index.php

      i do this for tgp submissions that dont allow .php extensions that my gallery program creates.

      so http://www.domain.com/index.php would work as http://www.domain.com/index.html

      or in my case

      http://www.domain.com/galleries/fuc/...sold/index.php

      would work as

      http://www.domain.com/galleries/fuc/...old/index.html

      Code:
      Options +FollowSymLinks 
      RewriteEngine On 
      RewriteCond %{SCRIPT_FILENAME} !-f 
      RewriteCond %{REQUEST_URI} ^(/.+\.)html$ [NC] 
      RewriteCond %{DOCUMENT_ROOT}%1php -f 
      RewriteRule \.html$ %1php [NC,QSA,L]
      hope that helps
      Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.

      Comment

      • daveylapoo
        Confirmed User
        • Dec 2003
        • 423

        #4
        Thanks for the responses.

        Looks like both of those will work; however, as I understand it the 'proper' way to do this involves the 301 / .htaccess redirect, as it should not affect your SE listings:

        http://www.google.com/support/webmas...n&answer=93633

        This is the code as it exists in the .htaccess now:

        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_URI} !^/index.php
        RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$ [NC]
        RewriteRule (.*) index.php
        RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
        RewriteRule index\.html index.php [NC,R]

        The last line is what should do it, however i think that something preceding this is causing the issue.

        Comment

        • Jdoughs
          Confirmed User
          • Mar 2004
          • 5794

          #5
          A 301 done properly will do exactly what you want. All ranking factors will be passed on accordingly to the 301'd page. (as long as you do it properly, this is not a tactic to rank new pages, only for 'moving' pages).

          Google (and yahoo should) will follow the command of the 301 and consider all weight to the "Permanently Moved" url to the new url.

          Save yourself some future grief, and never, link to the index.html, OR index.php. and link to the folder/directory. I wouldnt 301 it to the new index.php, I would 301 it to the sitename.com/ directory index. (then it wont matter what kind of index you use today, or in 10 years.
          LinkSpun - Premier Adult Link Trading Community - ICQ - 464/\281/\250
          Be Seen By New Webmasters/Affiliates * Target out webmasters/affiliates based on niches your sites are for less than $20 a month.
          AmeriNOC - Proudly hosted @ AmeriNOC!

          Comment

          Working...