The new forums will be named Coin Return (based on the most recent vote)! You can check on the status and timeline of the transition to the new forums here.
The Guiding Principles and New Rules document is now in effect.
Apache mod_rewrite and 404s
Seguerof the VoidSydney, AustraliaRegistered Userregular
Hey guys, I've been trying to rewrite everything to a single index.php file to be handled there, but my Apache throws out a 404 at /wbcms/test for example before getting rewritten. Any ideas?
The first condition is for my dev area (need to rewrite differently on different hosts), the second is to stop infitnite looping (Apache stops itself at 10), and the next two were trying to combat the 404.
I adapted this from the A List Apart article, How to Succeed With URLs as well as a bunch of other resources I found.
skips the 'inc' directory altogether, as well as the images folder. the regex pushes the requested url, with or without the trailing slash, to a variable. the site is at most 2 levels deep, so this works fine for me. so mysite.com/about/me resolves to page.php?page=about&sub=me
do you maybe need the [L] for last rule? ie, if the rule matches, stop processing.
granted, i don't know much, but maybe this can help?
flatlinegraphics on
0
Seguerof the VoidSydney, AustraliaRegistered Userregular
edited January 2009
Nope sorry, but thanks anyway. Mine can be any levels deep which is why I'm trying to get everything to be handled via php. Essentially you'd see something like example.com/projects/rewrite/how/to/make/it/work and php would start working with "/projects/rewrite/how/to/make/it/work" ($_SERVER) to determine what content to show.
EDIT: After some testing I manage to compress the rules
Posts
skips the 'inc' directory altogether, as well as the images folder. the regex pushes the requested url, with or without the trailing slash, to a variable. the site is at most 2 levels deep, so this works fine for me. so mysite.com/about/me resolves to page.php?page=about&sub=me
do you maybe need the [L] for last rule? ie, if the rule matches, stop processing.
granted, i don't know much, but maybe this can help?
EDIT: After some testing I manage to compress the rules
The -f and -d lines don't appear to do anything - Apache serves a 404 before attempting to apply this rule it appears, when it should be rewriting.