Forum Moderators: coopster
[size=2]Options +FollowSymLinks
RewriteEngine On
# rewrite php extensions to html
RewriteCond %{SCRIPT_FILENAME} -f [OR]
RewriteCond %{SCRIPT_FILENAME} -d
RewriteRule .* - [L]
RewriteRule ^([^/]*).html$ $1.php[/size]
[size=2]HTTP/1.1·200·OK(CR)(LF)
Date:·Tue,·16·Mar·2010·09:33:59·GMT(CR)(LF)
Server:·Apache/2.0.63·(Unix)·mod_ssl/2.0.63·OpenSSL/0.9.7a·mod_auth_passthrough/2.1·mod_bwlimited/1.4·FrontPage/5.0.2.2635(CR)(LF)
X-Powered-By:·PHP/4.4.7(CR)(LF)
Connection:·close(CR)(LF)
Transfer-Encoding:·chunked(CR)(LF)
Content-Type:·text/html(CR)(LF)
(CR)(LF)[/size] check with the host first to see if it is ok to setup parsing for php in the html extension.
if so I would have them make the change to apache and then I would remove the rewrite rule
I would then test numerous requests and a php file switched to html to be sure it is working before making any more changes
after that would be to remove html files and rename all the php files to html and test some more along the way
[size=2]Options +FollowSymLinks
RewriteEngine On
# redirect original requests for php extensions to html
# but do not redirect the internal requests (rewrites)
RewriteCond %(THE_REQUEST} \.php
RewriteRule ^([^.]+)\.php$ http://www.example.com/$1.html [R=301,L]
# rewrite php extensions to html
RewriteCond %{SCRIPT_FILENAME} -f [OR]
RewriteCond %{SCRIPT_FILENAME} -d
RewriteRule .* - [L]
RewriteRule ^([^.]+)\.html$ $1.php [L][/size]
THE_REQUEST contains the original request string, so the check is to see if the original request sent to the server contained .php and if so it should be redirected to .html.
[size=2]
Options +FollowSymLinks
RewriteEngine On
# redirect original requests for php extensions to html
# but do not redirect the internal requests (rewrites)
RewriteCond %(THE_REQUEST} \.php
RewriteRule ^([^.]+)\.php$ http://www.example.com/$1.html [R=301,L]
# rewrite php extensions to html
RewriteCond %{SCRIPT_FILENAME} -f [OR]
RewriteCond %{SCRIPT_FILENAME} -d
RewriteRule .* - [L]
RewriteRule ^([^.]+)\.html$ $1.php [L][/size]
I refreshed the browser and I could still see the unwanted .php page extensions pages.
It’s a 15 page static brochure website I think it would work just as well in xhtml?
An update the company said the best idea is to the change the site to html5.
Is this a good idea?