htaccess-for-nginx icon indicating copy to clipboard operation
htaccess-for-nginx copied to clipboard

QSA in RewriteRule only works if there is already a query string in the destination URL

Open alexandrucancescu opened this issue 2 years ago • 1 comments

https://github.com/e404/htaccess-for-nginx/blob/b81c1f1a4573839021284652c75e2a42d008d72a/htaccess.lua#L1229

RewriteRule p/ajax /ajax.php [QSA,L]

Will not work because the script will never append the querystring as it will not get past if new_qs then. So the querystring will be lost.

I need to append a random string to the destination path in order for QSA to work:

RewriteRule p/ajax /ajax.php?x=1 [QSA,L]

This works and passes the incoming querystring to the rewrite url.

alexandrucancescu avatar May 26 '23 10:05 alexandrucancescu

This is a duplicate of https://github.com/e404/htaccess-for-nginx/issues/27 which is fixed in P - so you can use that commit.

rkaiser0324 avatar May 27 '23 15:05 rkaiser0324