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
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.
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.
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):
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
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?
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?
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.
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.
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?
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.