0

So I'm using the answer from here to remove the query string: How to remove GET parameters from url with htaccess? And it works fine in general.

Here are the rules I'm using (in the beginning of the htaccess):

RewriteEngine on 
RewriteCond %{THE_REQUEST} \? 
RewriteCond %{QUERY_STRING} !^p= 
RewriteRule (.*) https://www.r-bloggers.com%{REQUEST_URI}? [R=301,L]

BUT...

If I browse using a mobile device to this url:

t.co/6raI2VkTse?amp=1

It will redirect me to this url (and will stay there, without a further redirect, even though it has a url parameter):

https://www.r-bloggers.com/how-to-handle-cran-checks-with-help-from-r-hub/amp/?p=182189&__twitter_impression=true

If I then refresh, it will redirect me to: https://www.r-bloggers.com/how-to-handle-cran-checks-with-help-from-r-hub/

I've tried adding:

RewriteEngine on
RewriteCond %{QUERY_STRING} ^(.*)&?__twitter_impression=[^&]+&?(.*)$ [NC]
RewriteRule ^/?(.*)$ /$1?%1%2 [R=301,L]

(from here) But this also didn't help.

I have no idea why this is happening. Any suggestions?!

Tal Galili
  • 24,605
  • 44
  • 129
  • 187
  • Maybe a cached result from earlier attempts? You will need to start debugging, so open your browsers development console and check the requests in the networking tab. – arkascha May 27 '19 at 02:10
  • 1
    It's helps you https://stackoverflow.com/questions/21118511/htaccess-301-redirect-remove-query-string-qsa – Full Stop May 27 '19 at 03:55

0 Answers0