How to process with apache2 all requests by one scr开发者_运维技巧ipt? Without mods if it is possible.
Generate URLs such as /index.php/topic/4/thread/3/
and then examine $_SERVER['PATH_INFO']
. Or just use normal query strings and use $_GET
.
I've did it with DocumentRoot:
DocumentRoot *site*/index.php
It generates warning, but it's working:
Warning: DocumentRoot [*site*/index.php] does not exist
use mod_rewrite, really. This is what it was made fore. Put something like this into .htaccess or the apache config:
RewriteEngine on
RewriteCond $1 !^(index\.php|css|images|javascript|robots\.txt|favicon\.ico)
RewriteRule ^(.*)$ /index.php/$1 [L]
This sends all requests except to some subdirectories you might want available for CSS, images, javascript, as well as files you want available such as robots.txt or favicon.ico to your index.php file, with the actual file requested added to the URL so index.php can process the request.
精彩评论