SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Enthusiast
    Join Date
    Feb 2007
    Posts
    88
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Will Mod Rewrite Hurt Me With Search Engines?

    Hi all,

    Okay, I have a totally html site. I want to build in php and mysql.

    So what I want to do is make the following changes and not loose all the links to my site and the ranks of the pages or the serp results i currently have.

    I want to rename the pages from html to php, e.g. :

    example1.html ---> example1.php
    example2.html ---> example2.php
    etc.

    So I am about to put this into .htaccess:
    Code:
    RewriteEngine On
    RewriteRule example1.html example1.php
    RewriteRule example2.html example2.php
    etc.
    However I am nervous that I will loose all the links, the serps and the page ranks.

    Is this a valid method a doing what I need to do and will it cause any headaches for me?

    Cheers for the responses
    Mooch

  2. #2
    Google Zombie ssandecki's Avatar
    Join Date
    Aug 2007
    Location
    Chicago, IL
    Posts
    665
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why do all that? Use the below code in your .htaccess file...

    AddType application/x-httpd-php .html

    Then you can use PHP code inside your *.html files Problem solved.

  3. #3
    In memoriam gold trophysilver trophybronze trophy Dan Schulz's Avatar
    Join Date
    May 2006
    Location
    Aurora, Illinois
    Posts
    15,476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I was going to suggest the same thing, ssandecki. Anyway, to answer the OP's question, using 301 redirects to forward your existing links to new locations won't do much to the search engines, since the spiders will still be able to follow them to the new location (which is the point). There will be a "small" dip to start, but it's just the search engines' way of updating the link paths in the database.

  4. #4
    SitePoint Enthusiast
    Join Date
    Feb 2007
    Posts
    88
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ssandecki View Post
    Why do all that? Use the below code in your .htaccess file...

    AddType application/x-httpd-php .html

    Then you can use PHP code inside your *.html files Problem solved.
    Is that all the code I need in the .htaccess file, just tried it and didn't work.

    Haven't worked with the .htaccess file before so it may be just me.

    Mooch

  5. #5
    Google Zombie ssandecki's Avatar
    Join Date
    Aug 2007
    Location
    Chicago, IL
    Posts
    665
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Mooch View Post
    Is that all the code I need in the .htaccess file, just tried it and didn't work.

    Haven't worked with the .htaccess file before so it may be just me.

    Mooch
    Display you current .htaccess file in this thread, you might have something conflicting it.

  6. #6
    He's No Good To Me Dead silver trophybronze trophy stymiee's Avatar
    Join Date
    Feb 2003
    Location
    Slave I
    Posts
    23,424
    Mentioned
    2 Post(s)
    Tagged
    1 Thread(s)
    From the Search Engine Optimization FAQ:

    I just changed from .html to .php. How can I switch without losing my rankings?

    There are two ways to do this:

    1) Tell Apache to parse all .html files a .php file. Using this method you do not have to change any files extensions or worry about any redirects. To do this, place this code in your httpd.conf file:
    Code:
    AddType application/x-httpd-php .php .html
    2) Use a 301 redirect to redirect from the .html files to the .php files. You can do that by placing this code in the root directory of your website:
    Code:
    RedirectMatch 301 ^/(.*)\.html$ http://www.yourdomain.com/$1.php


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •