[thelist] .php to .html....

hpoe evolt at webmediaconception.com
Mon Mar 18 01:52:00 CST 2002


In response to a message [Wahyu Harsono Hotmail] sent [01:37 17.03.02 +0700]:

>Use .htaccess maybe ?

Sure:

RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_URI} (.*)html$
RewriteRule (.*)html$ $1php

This should send requests for wherever/whatever/index.html to
your  _real_  document wherever/whatever/index.php

While RedirectMatch achieves the same effect, in doing so a 302 header
(Moved Temporarily) is sent back to the client along with the requested
page. This might not be what you want SE's to see. OTOH I'm not sure the
.php suffix even matters to SE's - as long as there's no query string(?)
attached.

Another option you might consider instead of all of this redirecting and
rewriting is content negotiation:

Options FollowSymLinks MultiViews
DirectoryIndex index

http://httpd.apache.org/docs/content-negotiation.html

In this case you can omit all suffixes from your URI's - provided you don't
have both somefile.php and somefile.gif :) This is also neat in case one
day you decide you want to go with .cfm or some such...

Here's some more interesting reading on SE friendly URI's:

http://www.evolt.org/article/Search_Engine_Friendly_URLs_with_PHP_and_Apache/17/15049/index.html

http://evolt.org/article/Search_Engine_Friendly_URLs_Part_II/17/17171/index.html

And by The Inventor Himself: http://www.w3.org/Provider/Style/URI.html

Regards,
hpoe

--
Henning Poerschke           http://webmediaconception.com
+49-700-WMCONCEPT        mailto:hp at webmediaconception.com




More information about the thelist mailing list