1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How do I redirect 100+ .html pages to .php pages?

Discussion in 'Apache' started by rahman15, Jul 26, 2006.

  1. #1
    It should be easy one but I am still not comfortable with 301 redirector.

    I have website with flat html pages. I would like to convert those HTML pages to PHP pages. I will have the same file name but only the php page extension.
    How can I do a 301 redirect that will redirect pages from html to php pages?

    I want to redirect:
    pages.html -------> pages.php
    SEMrush
    I have around 100+ HTML pages.


    Thanks,
     
    rahman15, Jul 26, 2006 IP
    SEMrush
  2. Cryogenius

    Cryogenius Peon

    Messages:
    1,280
    Likes Received:
    118
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I think you can do this in your .htaccess file (requires mod_rewrite):

    RewriteEngine on
    RewriteRule ^(.*)\.html$ http://full_domain/$1.php [R=301]​
    I think you might be better to keep the redirection internal, which cuts out a whole lot of HTTP requests and is faster for the user:

    RewriteRule ^(.*)\.html$ $1.php​
    This way, the users will still be accessing the .html files, but the webserver will actually be serving the output from the .php files to them. As far as they are concerned, your website has not changed. Obviously you don't need to change your internal links either.

    Cheers, Cryo.
     
    Cryogenius, Jul 27, 2006 IP
  3. sunday

    sunday Peon

    Messages:
    28
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    RedirectMatch 301 (.*)\.html$ http://www.example.com$1.php
     
    sunday, Jul 28, 2006 IP
  4. NC Software

    NC Software Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I have a utility that may help you out if you're web sites are running on Windows. The product is called siteDirector .NET. It has a free evaluation so you can explore it prior to purchase. I also invite any feedback for improvement, feature requests, etc. You can learn more about this product here at URL: http sitedirector.nc-software.com

    Hopefully this can help you out.
     
    NC Software, Aug 13, 2006 IP
  5. NC Software

    NC Software Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    woops, I didn't see that this was an apache forum, sorry about that!
     
    NC Software, Aug 13, 2006 IP