Pergunta

I have following htaccess rules in the folder example.com/folder/index.php

RewriteEngine On
RewriteRule ^(.*)-filter-(.*)\.html$ $1.php?filter=$2
RewriteRule ^(.*)\.html$ $1.php

So the URL is rewritten to: example.com/folder/index.html and example.com/folder/index-filter-stuff.html

Now when I echo $_GET["bla"] from example.com/folder/index.html?bla=value it works, I get the value. But when I echo it from example.com/folder/index-filter-stuff.html?bla=value then it's not working. So I get only values from non rewritten parameters when the URL doesn't contain rewritten parameters, what could be the problem?

Foi útil?

Solução

Most likely you are missing the QSA flag: "query string append":

RewriteEngine On
RewriteRule ^(.*)-filter-(.*)\.html$ $1.php?filter=$2 [QSA]
RewriteRule ^(.*)\.html$ $1.php [QSA]

I suggest you take a look at the excellent documentation of apaches rewriting module. It explains such things in detail and has lots of really good examples.

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