Jump to content

mod rewrite everything


michaellunsford

Recommended Posts

The basic idea is to have any request going to a certain directory be parsed by PHP.

So if the browser calls image.jpg. this works great:
[code]RewriteRule ^/?([^/]*)\.jpg$ index.php?page=$1 [L,NS][/code]
which returns "image.jpg" but the directory also has gif, png, pdf, html, php, and who knows what else. So, I tried removing the "\.jpg":
[code]RewriteRule ^/?([^/]*)$ index.php?page=$1 [L,NS][/code]
but this returns "index.php" -- where it got that is beyond me. I tweak it a bit
[code]RewriteRule ^(.*)$ index.php?page=$1 [L,NS][/code]
also returns "index.php" -- in fact, numerous variations of the above (which _should_ be a complete wildcard) also returns "index.php".


I'm so confused. What's missing here?
Link to comment
https://forums.phpfreaks.com/topic/3287-mod-rewrite-everything/
Share on other sites

  • 2 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.