我在我的.htaccess以下规则:的Apache的环境变量没有mod_rewrite的规则设定
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond $1 !^index\.php$
RewriteRule ^(.*)$ index.php?q=$1 [L]
</IfModule>
此查询字符串值q
设置为请求URI(就是那个索引之前剥离前述任一目录.php驻留在)。例如:http://localhost/framework/testing
组q=testing
。
我想改变这个,以便设置一个查询字符串,而不是设置一个环境变量。我曾尝试以下,但它不工作(环境VAR不被设置):
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond $1 !^index\.php$
RewriteRule ^(.*)$ index.php [ENV=request:$1,L]
</IfModule>
奇怪的是,环境VAR将设置如果请求与index.php文件开始,例如:http://localhost/framework/index.php/testing
套q=index.php/testing
你可以检查你的答案现在有效;) –
我想;它回答了我问的问题,但它不适用于别名的URL(共享ssl)。我的目标是不必在我的PHP中指定一个基本的URL。 –
这么好,错......修改你的问题,或检查这个有效,也许问另一个? –