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 to autometiclly make my all .php pages into .html in browser using HTaccess rewriting ??

Discussion in 'Apache' started by changezifoods, Jan 11, 2015.

  1. #1
    Hi there
    i have made my all pages with .html extension and hence my SEO is based on accordingly. Now i made some changes to htaccess that causes to not inclusion of header and footer pages (both are made with .php extension ). so i decided to change the extension of pages (.html to .php) and it wokrs. due to SEO and large number of pages i want all my pages .php (made later). to get converted automatically with .html in browser. so is it possible using .htaccess rewrite. if yes then please suggest the steps ??
     
    changezifoods, Jan 11, 2015 IP
  2. MilesWeb

    MilesWeb Well-Known Member

    Messages:
    869
    Likes Received:
    35
    Best Answers:
    7
    Trophy Points:
    173
    #2
    Below is the code you can use so that .php pages are redirected to .html

    #Redirects if a request for a php files comes in.
    RewriteCond %{REQUEST_URI} .php$
    RewriteRule ^(.*)\.php.?$ $1.html [R=301,L]

    #Rewrites requests for html files to find the php file on disk.
    RewriteRule ^(.*)\.html$ $1.php

    OR

    RewriteRule ^(.*)\.html$ $1.php [L]
     
    MilesWeb, Jan 13, 2015 IP