9 replies
  • WEB DESIGN
  • |
I am recoding a client's website and because of the host they are on and using PHP, I'm changing all the webpages from .html to .php.

/productA.html is now /productA.php ... and so forth

Instead of listing nearly 400 pages individually in the .htaccess using 301 ...
Is there a shorthand to say redirect all the .html to their .php equivalents?
#301
  • Profile picture of the author KathyK
    Code:
    RedirectMatch 301 (.*).html$ http://www.yourdomain.com$1.php
    That should do it - it will direct ALL .html pages to .php

    So if you have any html pages left, they will break. You'll need to be sure everything is php!

    Change only the domain in there to yours - that $1 is part of the 'magic'
    Signature

    Cheers,
    Kathy

    {{ DiscussionBoard.errors[2289013].message }}
  • Profile picture of the author WebsiteManagers
    In your .htaccess file you can set the default home page with this (providing GoDaddy allows rewriting options):
    Code:
    DirectoryIndex index.php default.php home.html index.html
    or simply
    Code:
    DirectoryIndex index.php
    (You will have to make sure there is always an index.php)
    Signature

    We do not represent the web hosts who are selling out to investors; we rescue their victims. Website Managers, LLC - Web Hosting & Private Servers Since 1998

    {{ DiscussionBoard.errors[2379973].message }}
  • Profile picture of the author WebsiteManagers
    Put the DirectoryIndex first and your redirect should work the way you want it to.
    Signature

    We do not represent the web hosts who are selling out to investors; we rescue their victims. Website Managers, LLC - Web Hosting & Private Servers Since 1998

    {{ DiscussionBoard.errors[2380156].message }}
    • Profile picture of the author Barbara Eyre
      Excellent! It worked great. Thank you so very much! =)

      "Love it when a plan comes together."
      - Hannibal, The A-Team
      {{ DiscussionBoard.errors[2380350].message }}
      • Profile picture of the author nmarley
        Originally Posted by Barbara Eyre

        I just tried this on a website that is on GoDaddy Linux server.

        When you type in the www.domain.com, instead of taking you to the /index.php ... it wants to take you to /default.php, which doesn't exist.

        Is there something different that has to be done for GoDaddy (like everything else it seems) ??

        Another way to solve would be to create an exact copy of "index.php" called "default.php". Not the best solution, but when you're in a bind & need a quick fix...
        {{ DiscussionBoard.errors[2381016].message }}

Trending Topics