Skip to content
Advertisement

rewrite url and let more parameters

I am rewriting this kind of urls

http://deia.info/category/calendar/10/

To

/index.php?task=browse_posts&catid=$2

By this code in the .htaccess

RewriteRule ^category/(.+)/(.+) /index.php?task=browse_posts&catid=$2

Which seems to do the job. The problem is when additional parameters are sent, those are ignored.

For example:

http://deia.info/category/calendar/10/?start_date=10

isset($_GET['start_date']) won’t return true

Why?

Advertisement

Answer

When the incoming URL holds a query like in the OP example:

http://deia.info/category/calendar/10/?start_date=10

The way to combine (Append) it with/to a new query in the substitution URL, is by adding the QSA Flag.

So add [L,QSA], like this:

RewriteRule ^category/(.+)/(.+) /index.php?task=browse_posts&catid=$2 [L,QSA]
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement