I’m trying to route all unexisting folders to a specific PHP script with mod_rewrite but I couldn’t handle it.
Here is the scenario, I’ve some folders like /images, /gallery, /js etc. Some of them has their own .htaccess files and php scripts under directories…
What I have to do is, without blocking these folders and their own rules redirecting all other requests to /subject/content.php file..
I tried something like this but unfortunately doesn’t work
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-zA-Z0-9]+)/(.*)-(.*).html /subject/content.php?ID=$2
At the end, URLs should be like /sports/123-how-to-lose-weight.html
Also I’m trying the same for category pages. And they should be routed like
http://www.blabla.com/sports –> /subject/category.php?cat=sports
(ps: I also couldn’t see anything on RewriteLog with level 9 logging when requesting pages according to upper rules)
Thank you very much for your help 🙂
Could you try these;
But first:
RewriteEngine On. 🙂