Shahin Ataei Shahin Ataei - 3 months ago 14
Apache Configuration Question

why index keyword is return empty $_GET on seo url with htaccess in apache 2.4.18?

I use wamp server 3.0.4

my htaccess code is here

AddDefaultCharset UTF-8
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?_url=/$1 [QSA,L]




but when i enter this
url = "localhost/myproject/index"


my
$_GET
array is empty =
array()


when i enter this
url = "localhost/myproject/second"


my
$_GET
array is =
[_url] => /second/

Answer

That is due to use MultiViews option turned on. Option MultiViews (see http://httpd.apache.org/docs/2.4/content-negotiation.html) is used by Apache's content negotiation module that runs before mod_rewrite and makes Apache server match extensions of files. So if /index is the URL then Apache will serve matching /index.php.

Turn it off using this line at top of .htaccess:

Options -MultiViews
Comments