The Moz Q&A Forum

    • Forum
    • Questions
    • My Q&A
    • Users
    • Ask the Community

    Welcome to the Q&A Forum

    Browse the forum for helpful insights and fresh discussions about all things SEO.

    1. SEO and Digital Marketing Q&A Forum
    2. Categories
    3. Technical SEO Issues
    4. Will changing page extensions from .html to .php require a redirect?

    Will changing page extensions from .html to .php require a redirect?

    Technical SEO Issues
    10 5 1.2k
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as question
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • theideapeople
      theideapeople last edited by

      Hi.

      We are launching a new website and our .html page extensions will be replaced with a .php page extension.

      Example:   www.theideapeople.com/web_design.html  (current url)

      www.theideapeople.com/web_design.php  (new url)

      Will this require any special treatment to maintain the page SEO ranking?  Does it make a difference if you use a .html or .php?  Thank you for your help and insight!

      Jay

      1 Reply Last reply Reply Quote 0
      • Maximise
        Maximise last edited by

        Hi Jay,

        The two will be viewed as entirely different pages. You will need to 301 redirect all .html pages to the .php version.

        1 Reply Last reply Reply Quote 3
        • sferrino
          sferrino last edited by

          If you are doing this to all pages on the site you can knock it out with an htaccess file like this:

          Options +FollowSymlinks
          RewriteEngine on
          RewriteRule ^(.*).html$ $1.php [NC]

          Maximise 1 Reply Last reply Reply Quote 0
          • Maximise
            Maximise @sferrino last edited by

            Will that return a 301 header though? Shouldn't it include "R=301"?

            sferrino 1 Reply Last reply Reply Quote 1
            • darrinward
              darrinward last edited by

              The better solution is to keep the .html extensions but tell Apache to parse them as though they were php. This is easily done in .htaccess:

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

              I do this with pretty much all of my sites because real .html files are still served fine, and when there is php code it is executed as it would be with a .php file.

              theideapeople 1 Reply Last reply Reply Quote 0
              • sferrino
                sferrino @Maximise last edited by

                Nice catch. I agree it should be:

                Options +FollowSymlinks
                RewriteEngine on
                RewriteRule ^(.*).html$ $1.php [R=301]

                1 Reply Last reply Reply Quote 2
                • theideapeople
                  theideapeople @darrinward last edited by

                  Good stuff, thank you for taking the time to help!

                  1 Reply Last reply Reply Quote 0
                  • theideapeople
                    theideapeople last edited by

                    Thank you all very much for your help and answers.  It is very much appreciated!!

                    1 Reply Last reply Reply Quote 0
                    • darrinward
                      darrinward last edited by

                      You're welcome, but please keep in mind that 301 redirects have an inherent loss of PageRank, even though it's quite small - no loss is better than some!

                      1 Reply Last reply Reply Quote 0
                      • KeriMorgret
                        KeriMorgret last edited by

                        You might also consider writing the redirect so that you don't have any extensions (see the SEOmoz URL for an example). That way, whenever you next change technologies, your URL will still stay the same.

                        1 Reply Last reply Reply Quote 1
                        • 1 / 1
                        • First post
                          Last post
                        • Should the canonical tag for the redirected pages be changed
                          AnahitG
                          AnahitG
                          0
                          3
                          31

                        • Will redirecting a logged in user from a public page to an equivalent private page (not visible to google) impact SEO?
                          0
                          1
                          28

                        • How do I redirect old html pages to new site?
                          ThompsonPaul
                          ThompsonPaul
                          0
                          5
                          344

                        • Moving site from html to Wordpress site: Should I port all old pages and redirect?
                          Linda-Vassily
                          Linda-Vassily
                          0
                          2
                          56

                        • URL structure change for pages without traffic: 301 redirect or not ?
                          BlueCorona
                          BlueCorona
                          0
                          5
                          96

                        • I am using All-in-One-seo. I change the title and meta description on the home page, but it is not showing up on the search. It is on the source code. When I change other pages, the both show up in the search, just not the home page. Any idea why?.
                          jgodwin
                          jgodwin
                          0
                          11
                          3.2k

                        • If I want clean up my URLs and take the "www.site.com/page.html" and make it "www.site.com/page" do I need a redirect?
                          Booj
                          Booj
                          0
                          4
                          113

                        • URL change extension to .php from .htm
                          AndyAtkins
                          AndyAtkins
                          0
                          7
                          1.1k

                        Get started with Moz Pro!

                        Unlock the power of advanced SEO tools and data-driven insights.

                        Start my free trial
                        Products
                        • Moz Pro
                        • Moz Local
                        • Moz API
                        • Moz Data
                        • STAT
                        • Product Updates
                        Moz Solutions
                        • SMB Solutions
                        • Agency Solutions
                        • Enterprise Solutions
                        • Digital Marketers
                        Free SEO Tools
                        • Domain Authority Checker
                        • Link Explorer
                        • Keyword Explorer
                        • Competitive Research
                        • Brand Authority Checker
                        • Local Citation Checker
                        • MozBar Extension
                        • MozCast
                        Resources
                        • Blog
                        • SEO Learning Center
                        • Help Hub
                        • Beginner's Guide to SEO
                        • How-to Guides
                        • Moz Academy
                        • API Docs
                        About Moz
                        • About
                        • Team
                        • Careers
                        • Contact
                        Why Moz
                        • Case Studies
                        • Testimonials
                        Get Involved
                        • Become an Affiliate
                        • MozCon
                        • Webinars
                        • Practical Marketer Series
                        • MozPod
                        Connect with us

                        Contact the Help team

                        Join our newsletter
                        Moz logo
                        © 2021 - 2026 SEOMoz, Inc., a Ziff Davis company. All rights reserved. Moz is a registered trademark of SEOMoz, Inc.
                        • Accessibility
                        • Terms of Use
                        • Privacy