Help converting html to php and keeping current PR

Discussion in 'Search Engine Optimization' started by annunaki10, Oct 25, 2008.

  1. #1
    I'm about to buy an old site that has many pages with PR3+. The whole site is comprised of static html files. Each file contains the full layout and the content for that page. I don't want to keep it this way because updating it will be a nightmare. I want to convert to php so I can have a header and footer script so updates will be super fast.

    So my questions are:

    1) Should i leave the site alone and deal with it? Updates will have to go into each file one by one. If so, is there an easy method or program for doing this?
    2) Create corresponding php files for each html file and use 301 redirects in .htaccess? Will the redirects really preserve the PR?
    3) Another idea that i can't think of.


    Thanks
     
    annunaki10, Oct 25, 2008 IP
  2. Colbyt

    Colbyt Notable Member

    Messages:
    3,224
    Likes Received:
    185
    Best Answers:
    0
    Trophy Points:
    210
    #2
    More than likely you can parse html pages as php by modifying your .htaccess file. I don't recall the exact sytax at the moment. By doing so you can keep the page names the same.

    The other option as you stated is to 301 redirect the old page name to the new which isn't much work for a few pages. Not sure about the PR implications.
     
    Colbyt, Oct 25, 2008 IP
  3. siflur

    siflur Well-Known Member

    Messages:
    1,246
    Likes Received:
    30
    Best Answers:
    0
    Trophy Points:
    115
    #3
    Just make a 301 redirect by modifying your .htaccess file, though Google will probably find out either way.
    It can be done like this:
    Redirect 301 /OldPage.html /NewPage.php
    Will the redirects really preserve the PR?
    Google says it does.
     
    siflur, Oct 25, 2008 IP
    jitendraag likes this.
  4. annunaki10

    annunaki10 Active Member

    Messages:
    58
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    93
    #4
    That's what i thought.

    Thanks siflur
     
    annunaki10, Oct 25, 2008 IP
  5. jitendraag

    jitendraag Notable Member

    Messages:
    3,982
    Likes Received:
    324
    Best Answers:
    1
    Trophy Points:
    270
    #5
    I would go with silfur's advice. Something like following should help you.

    
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    # To make sure that you don't have an actual HTML file by that name :)
    RewriteRule ^*.html$ $1.php
    
    Code (markup):
     
    jitendraag, Oct 26, 2008 IP
  6. rena

    rena Peon

    Messages:
    1,987
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Sure u will face problem. All pages name will changed like index.html to index.php. So google has to re index it and all the indexed file will be broken links. So u will be in trouble
     
    rena, Oct 26, 2008 IP
  7. annunaki10

    annunaki10 Active Member

    Messages:
    58
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    93
    #7

    I currently have about 5 sites hosted with my account. It looks like this rule will be applied to all sites. How can this be modified to only work for just one of them?
     
    annunaki10, Oct 26, 2008 IP
  8. jitendraag

    jitendraag Notable Member

    Messages:
    3,982
    Likes Received:
    324
    Best Answers:
    1
    Trophy Points:
    270
    #8
    Include the domain name in RewriteCond.
     
    jitendraag, Oct 26, 2008 IP
  9. annunaki10

    annunaki10 Active Member

    Messages:
    58
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    93
    #9
    I'm really not good at .htacess at all. Would you mind updating the block you originally posted?

    Also, this will take care of .html files accross the board right? This is so i won't have to write a seperate 301 rule for each existing file?
     
    annunaki10, Oct 26, 2008 IP
  10. jitendraag

    jitendraag Notable Member

    Messages:
    3,982
    Likes Received:
    324
    Best Answers:
    1
    Trophy Points:
    270
    #10
    Put another rewrite condition :)

    
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{HTTP_HOST} ^www\.domain\.net
    # To make sure that you don't have an actual HTML file by that name :)
    RewriteRule ^*.html$ $1.php
    
    Code (markup):
    Try this on local host before you try it on your live server.
     
    jitendraag, Oct 26, 2008 IP
  11. annunaki10

    annunaki10 Active Member

    Messages:
    58
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    93
    #11
    In depth question about my current .htaccess and what to do with it next.

    I currently have several domains under one account. My directories look something like this:
    /htdocs/dom1
    /htdocs/dom2
    /htdocs/dom3
    /htdocs/dom4

    In my current .htaccess file, i have a rewite rule for each of the hosts:

    RewriteEngine On
    Options +FollowSymlinks
    RewriteBase /
    RewriteCond %{HTTP_HOST} domain1.com
    RewriteCond %{REQUEST_URI} !dom1/
    RewriteRule ^(.*)$ dom1/$1 [L]

    This block is duplicated 4 times, each time for a different domain.

    This all works great, no probs.

    So here's the problem/question.

    I just bought a site and all the files are .htm. As it turns out, there was a .htaccess file already in place that did the redirects. Instead of it being 301 redirects, the exact line is:
    RewriteRule codes.htm$ codes.php

    This rule doesn't work currently. I did however get a 301 redirect working like this:
    redirect 301 /dom5/code.htm http://www.domain5.com/code.php

    Is there a difference between RewriteRule and redirects? Is one better than the other? Why in the current 301, I can't just use
    redirect 301 /dom5/code.htm /dom5/code.php
    and instead, i have to put the full domain?

    Maybe I over complicated all of this and there's a much easier way to take care of this. Any help would be greatly appreciated.
     
    annunaki10, Oct 27, 2008 IP
  12. annunaki10

    annunaki10 Active Member

    Messages:
    58
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    93
    #12
    Something else i just noticed. The original site is still live, i haven't done the DNS change. When i navigate that site, all the links are .htm and in the url bar, i see .htm. However on my test, with the 301 redirect, it's changed to file.php. I guess that's the difference between the redirect and rewriterule. With my current configuration, how would i keep this behavior the same?
     
    annunaki10, Oct 27, 2008 IP
  13. annunaki10

    annunaki10 Active Member

    Messages:
    58
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    93
    #13
    After some playing around, i found the easy solution.

    RewriteRule ^dom5\/(.*)\.htm$ $1.php [NC]

    This will send all requests to any .htm file on that host to a php file. This will keep the address the same though.
     
    annunaki10, Oct 28, 2008 IP