1

I have a rule in my .htaccess file to overwrite ugly parameter urls with clean paths.

Here is an example:

RewriteRule ^landing(/)?([0-9]+)?(/)?$ landing/index.php?intPage=$2

So when someone goes to /landing/3, it would load the index.php page passing intPage parameters as 3.

Very simple.

However, I'm using techniques to trace Google Analytics referals, so I need to tack parameters onto this URL:

For example:

/landing/3?kt_type=ad&kt_st1=adwords&kt_st2=prize_a_us.en

The problem is that, I don't know how to retrieve the parameters that are tacked onto the URL, since the URL has already been overwritten and now I can't retrieve kt_type, kt_st1 etc.

Any idea on how to make it possible so I can still tack parameters to already overwritten URLs?

Armin
  • 369
  • 2
  • 5
  • 23

1 Answers1

2

Use QSA flag. Change your rule to this:

RewriteRule ^landing/?([0-9]+)?/?$ landing/index.php?intPage=$1 [L,NC,QSA]

From official docs:

QSA - Appends any query string from the original request URL to any query string created in the rewrite target

anubhava
  • 761,203
  • 64
  • 569
  • 643