Silekin Sergey
Silekin Sergey

Reputation: 91

htacces RewriteRule return empty $_GET

My RewriteRule:

RewriteEngine On
RewriteRule ^popup/(.+)/$ /popup.php?name=$1 [L,QSA]

Locally it working fine, in the $_GET I'm getting variable "name" with expected value. But it doesn't work on production server. My $_GET is empty, but server redirect me on popup.php script.

EDIT1: var_dump of $_SERVER valiable on popup.php:

SERVER_SOFTWARE => Apache/2.2.15 (CentOS)
SERVER_ADDR => 127.0.0.1
SERVER_PORT => 80
REMOTE_ADDR => 127.0.0.1
DOCUMENT_ROOT => /var/www/site.dom/htdocs
SERVER_ADMIN => root@localhost
SCRIPT_FILENAME => /var/www/site.dom/htdocs/popup.php
REMOTE_PORT => 60763
GATEWAY_INTERFACE => CGI/1.1
SERVER_PROTOCOL => HTTP/1.0
REQUEST_METHOD => GET
QUERY_STRING => 
REQUEST_URI => /popup/work/
SCRIPT_NAME => /popup.php
PATH_INFO => /work/
PATH_TRANSLATED => redirect:/parse_request.php/
PHP_SELF => /popup.php/work/

What PATH_TRANSLATED mean?

Upvotes: 1

Views: 555

Answers (1)

anubhava
anubhava

Reputation: 785176

This is due to options MultiViews on your web server. Add this line on top of .htaccess to disable it:

Options -MultiViews

Option MultiViews is used by Apache's content negotiation module that runs before mod_rewrite and and makes Apache server match extensions of files. So /file can be in URL but it will serve /file.php thus superseding your rewrite rule.

Upvotes: 2

Related Questions