Trick ReWrite

I’m trying to achieve something a bit tricky. not sure if its possible.

what i want to do is (this will call page.php) (this will call list.php, however the trailing needs to be unlimited. I have a URI Mapper handling this.

I currently have follow but its kind of backwards.

RewriteRule ^/?(.).html$ list.php?pg=$1
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.
)$ $1.php

Result is (gets page.php) only because i remove the php extension when i add .html it goes to list. works

Basically i want it to be like if its list.php then use the rewrite everything is else should be .html or run as a regular page.

cuz if i tried to run a file in another directory it think i’m still using list.php



Sorry to burst your bubble but it’s not tricky at all. Your code has problems (besides not using the [noparse]


[/noparse] wrapper) …

RewriteEngine on

# matches xyhtml, i.e., the dot character needs to be escaped to match ONLY the dot character
# ^/? is only required if you don't know whether your on an Apache 1 or Apache 2 server. 
# IMHO, find out and either use ^/ for Apache 1.x or ^ for Apache 2.x
# Since I don't believe there are any Apache 1.x servers out there any more ...
RewriteRule ^(.*)\\.html$ list.php?pg=$1 [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\\.php -f
RewriteRule ^(.*)$ $1.php [L]
# PLEASE learn to use mod_rewrite's flags

Sorry, the English got so twisted there that I’m not sure what you’re asking. It seems to be that you only want list.html to be redirected to the php script, not other .html pages. If that’s the case, WHY did you use the dreaded :kaioken: EVERYTHING (or NOTHING) atom :kaioken: to specify … well, EVERYTHING (or NOTHING) instead of … what?



No Edit available? :stuck_out_tongue:


Please note that, if you change the order of the RewriteRule (block) statements and the .html file(s) do not exist, they’ll be redirected to index.php and NEVER to list.php.