我用的是wamp server 3.0.4
我的htaccess代码在这里
AddDefaultCharset UTF-8
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?_url=/$1 [QSA,L]
但是当我进入这个url = "localhost/myproject/index"
my $_GET
array is empty = array()
当我进入这个url = "localhost/myproject/second"
my $_GET
array is = [_url] => /second/
这是由于使用MultiViews
选项打开。选项MultiViews
(参见http://httpd.apache.org/docs/2.4/content-negotiation.html)由Apache's content negotiation module
使用,它在 mod_rewrite
之前运行,并使Apache服务器匹配文件的扩展名。因此,如果/index
是URL,那么Apache将提供匹配的/index.php
。
使用。htaccess:
Options -MultiViews