I'm using this rule:
- Code: Select all
RewriteRule ^(.*)/$ index.php?s=$1 [L]
To redirect:
/section/subsection/
to
index.php?s=section/subsection
index.php then checks the variable s against a DB of entries and includes a different page depending on the section.
In the DB I store the sections all in lowercase and I compare them using LCASE in the SQL query, so that
/section/
/Section/
/SeCtIoN/
all direct to the same page
Now.... everything seems to work perfectly! Well, almost everything.
Specifically, if I write
/Section/
/SEction/
/seCtion/
/secTIOn/
and so on, it always works but if I write
/section/
it does not work... I get a 404 server error (URL /section/ not found)
This applies ONLY to the section names I have in the DB.... it's not just a lowercase thing. If I write:
/sectionwhichdoesnotexist/
the server shows index.php, that then gives the error (this page does not exist).
Now my question is: how on Earth is this possible?? Am I missing something really obvious?
If I change the code in index.php just to:
- Code: Select all
die("blablabla");
so that it doesn't even get to the point when it reads the DB, it still doesn't work.
Is mod_rewriting decided that it automatically has to read my database without me asking for it? Or what?
Oh, I was almost forgetting! Obviously all of this works without a problem locally on my laptop...