Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

We have a website with good SEO results. For design reasons I have to update the design and I have to change file names from .html to .php. But I keep my domain name!

What should I do in order to keep my good SEO results?

share|improve this question
    
Try googleing on mod rewrite and htaccess. –  Siyah Feb 25 at 9:31
2  
1  
I'd omit the file extension. So you won't have any problems if you switch to asp (or something else) in a few years –  Reeno Feb 25 at 14:14
    
I wouldn't change the file extensions to php. Either omit them, or keep htm. Silently redirect to the appropriate php files on the server. –  CodesInChaos Feb 25 at 16:44
add comment

2 Answers 2

You can use one of these solutions:

  • Keep the Current .html extension unchanged for just frontend purpose and use Apache .htaccess file to proxify your requests so that. Add this to your .htaccess file to work:

    RewriteEngine on
    RewriteRule ^(.*).html $1.php

OR

  • Why not just have the HTML pages parsed as PHP? That way you can get the best of both php and html.

    AddHandler application/x-httpd-php .php .html .htm

share|improve this answer
add comment

Just redirect by 301 HTTP status all your old URLs to the new ones. If you only change file extension, you can do it easily with an .htaccess file (if you use Apache as a web server). Put these lines in your .htaccess file:

RedirectMatch 301 (.*)\.html$ http://www.example.com$1.php

Of course, change www.example.com by your domain name.

By using 301 redirects, you lose a little bit of SEO value (PageRank) for your pages but this is the best option you have.

P.S.: like Geoff Jackson suggests in comments, if you can use URLs without file extensions, it will be a good option because you will get better user friendly URLs. The .htaccess code for this:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html
share|improve this answer
3  
@Kos Further to this answer, you could go one better still and remove the file extension from the URL's altogether with .htaccess. –  zigojacko Feb 25 at 10:12
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.