.htaccess tutorial

htaccess Elite


Using .html instead of .php

Search Engine Optimization using Htaccess

Using .html instead of .php

New postby produke » 30 Oct 2006 10:48

I am using a mod like this for the htaccess forum at htaccesselite.com, where instead of
http://www.htaccesselite.com/htaccess/index.php the url is http://www.htaccesselite.com/htaccess/htaccess-vc1.html

and for http://www.htaccesselite.com/htaccess/viewtopic.php?t=5 its
http://www.htaccesselite.com/htaccess/caching-using-mod-expires-with-expires-vt5.html


This rewrites internally all .html files to .php
Code: Select all
RewriteEngine On
RewriteBase /
RewriteRule (.*)\.html$ $1.php [L,T=application/x-httpd-php]


Forcing any files to be a certain type of file:
Code: Select all
<Files index.php>
ForceType application/x-httpd-php
</Files>


Name php files .html
Code: Select all
AddType application/x-httpd-php .html


If using phpbb:

Remove SID for guests
phpBB SEO mod rewrites
Gives you an htaccess like this-
Code: Select all
RewriteEngine On
RewriteBase /

RewriteRule ^s/(.*)\.pl$ /cgi-bin/$1.php [L]


# FORUMS PAGES
########################
# FORUM PROTECTION RULE
RewriteRule ^htaccess/.+/([^/]+\.html)$ /htaccess/index.php [R=301,L]
# CATEGORIES
RewriteRule ^htaccess/.+-vc([0-9]+)\.html$ /htaccess/index.php?c=$1 [QSA,L]
# PAGINATED FORUM
RewriteRule ^htaccess/.+-vf([0-9]+)-([0-9]+)\.html$ /htaccess/viewforum.php?f=$1&start=$2 [QSA,L]
# FORUM
RewriteRule ^htaccess/.+-vf([0-9]+)\.html$ /htaccess/viewforum.php?f=$1 [QSA,L]
# PAGINATED TOPIC
RewriteRule ^htaccess/.+-vt([0-9]+)-([0-9]+)\.html$ /htaccess/viewtopic.php?t=$1&start=$2 [QSA,L]
# TOPIC
RewriteRule ^htaccess/.+-vt([0-9]+)\.html$ /htaccess/viewtopic.php?t=$1 [QSA,L]
# POST
RewriteRule ^htaccess/post([0-9]+)\.html$ /htaccess/viewtopic.php?p=$1 [QSA,L]
#PROFILES
RewriteRule ^htaccess/member([0-9]+)\.html$ /htaccess/profile.php?mode=viewprofile&u=$1 [QSA,L]


.htaccess to ADD .php file extensions .htaccess / Scheduled Jobs
html to php
User avatar
produke
 
Posts: 242
Joined: 25 Sep 2006 04:48

Re: Using .html instead of .php

New postby olivia » 03 Dec 2008 03:14

Hi Produke,

Thank you for your information I think it is usefull for all............
olivia
 
Posts: 7
Joined: 03 Dec 2008 02:49


Return to SEO