ITChristian
ITChristian

Reputation: 11271

HTACCESS friendly url and allow GET method

My code is

 Options -Multiviews

 RewriteEngine On
 RewriteBase /

 RewriteRule ^([a-z0-9-]+)\.html$ /index.php?cat=$1 [L]

If I access

mysite.com/name-of-category.html 

it works, but if I access

mysite.com/name-of-category.html?anything=something

it shows the webpage but $_GET["anything"] shows nothing.

Upvotes: 3

Views: 530

Answers (1)

Answerer
Answerer

Reputation: 66

You must specify an option called QSA or 'Query String Append':

RewriteRule ^([a-z0-9-]+)\.html$ /index.php?cat=$1 [L,QSA]

It will ensure that the original query strings are also included as part of your new URL.

Upvotes: 5

Related Questions