mod_rewrite: How to get all requests and send to a PHP script for routing?
I need the Rewrite settings and rules for getting all serv开发者_JS百科er/URL requests and send them to a PHP script, and later route the requests from that PHP.
Is this possible and how?
I have the following, but with this I can't process all requests to my PHP script:
RewriteRule ^([0-9]+) router.php?first_request=$1
You get the idea what I want...
Put these rewrite rules to your .htaccess file, which would redirect all requests which are not pointing to valid directory or file to your specific script:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ your_php_file.php?url=$1
From your script you can obtain value of the url variable $_GET['url'] and split it as needed.
精彩评论