Jump to content

[SOLVED] Changing all site files from html to php


ultrasound0000

Recommended Posts

Assuming you use the same filenames, but with a php extension instead of html, then you can do this using Apache's httpd.conf or .htaccess:

 

RewriteEngine on
RewriteRule (.*)\.html$ $1.php [R=301,L]

 

Edit: I should learn to read the entire post before replying. You're using IIS. Anyway, yes, you do need 301 redirects if you don't want to hurt your rankings.

Link to comment
Share on other sites

I am in the process of changing all my site files from html to php.  How does this affect SEO?

 

Your pages are viewed by the crawler how you view them.  PHP is server side but produces HTML in the end so it should have no effect for SEO.

 

The best way to ensure this is to run your site through the W3 Validator.

Link to comment
Share on other sites

Your pages are viewed by the crawler how you view them.  PHP is server side but produces HTML in the end so it should have no effect for SEO.

 

He is moving/renaming the pages. This means the old, index and linked-to page will now result in a 404. That will negatively effect his rankings.

 

At least that's how I interpret his post.

Link to comment
Share on other sites

@Daniel0 - Yes it's a windows box unfortunately, otherwise I knew about the apache trick as well.  And yes you are right, I do believe that since the file extensions will no longer be .html but .php I'll have to figure out a way to redirect the pages.  Just like you recommended with apache, with one line of code, but not sure if this is possible on IIS.  Otherwise I might have to do a 301 for each page which would totally suck.

 

So this topic remains open to suggestions ...

Link to comment
Share on other sites

Actually found out that you can map html to run php code (or just html code if no php code present) in IIS, so that is solved.

 

However I'm not sure if this is the best approach long term. Is it ok to use .html extensions for a php site, are there any drawbacks? 

 

I hope someone has some ideas or suggestions on this.

Link to comment
Share on other sites

  • 1 month later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.