Forum Moderators: phranque

Message Too Old, No Replies

PHP Handler

         

mumraa

3:54 pm on Jul 16, 2007 (gmt 0)

10+ Year Member



Hi everyone

Am setting up a web system, and am after rewriting the documentroot to a php handler file

Along the lines of

Rewrite http://www.example.com /handler.php?page=index.html

Already got all .html files running through it in the form of

RewriteRule ^(.*?).htm$ handler.php?page=$1.htm

Just struggling with the root domain

[edited by: jdMorgan at 4:28 pm (utc) on July 16, 2007]
[edit reason] example.com [/edit]

jdMorgan

4:27 pm on Jul 16, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Just modify the rule to accept requests for the root index page "/" :

RewriteRule ^(.+\.htm)?$ handler.php?page=$1 [L]

Here, the pattern will accept ^<something.htm>$ or ^$ -- the latter being matched if example.com/ is requested.

If some special (non-blank) "page=" value is required for requests to the root index page, then a separate rule can be used for just that case.

Jim