Pergunta

Following is the rule:

RewriteRule ^api/([\w-]+)/?$ api.php?method=$1 [QSA]

On local Apache 2.4 server, it allows me to rewrite like:

/api/create-account/?name=abcd 

to

/api.php?method=create-account&name=abcd

On production server, which is Apache 2.2, the request goes to api.php. But I find not query string parameter in my script. If I dump $_REQUEST, $_GET or $_POST, I only get empty array.

What am I missing?

Foi útil?

Solução

You need to turn off Multiviews:

Options -Multiviews

Multiviews is a mod_negotiation option that tells it to try to match a request to physical files. When it sees a request like /api/somtehin and then sees that there's a file named api.php, it will map to that file right away, completely bypassing mod_rewrite.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top