regex - How to strip &_escaped_fragment_=?view=classic type parameters off of end of incoming url requests in .htaccess -


google appending following parameters (among others) end of search listings , website cannot handle , need them stripped off code in .htaccess file:

&_escaped_fragment_=?view=classic &_escaped_fragment_=?view=flipcard &_escaped_fragment_=?view=magazine &_escaped_fragment_=?view=mosaic &_escaped_fragment_=?view=snapshot &_escaped_fragment_=?view=timeslide 

i have received response @croises remove other parameters adding , current code follows:

rewriteengine on rewritecond %{query_string} ^.+$ rewriterule (.+\.html?)$ $1? [nc,r=301,l] 

how should modify code above handle &_escaped_fragment_=?view=... parameters too?

@anubhava, want me implement, code first in list? again!

rewriteengine on rewritecond %{query_string} ^view=[^&]+ [nc] rewriterule ^(.+?)&_escaped_fragment_= /$1? [nc,ne,r=301,l] rewritecond %{query_string} ^.+$ rewritecond %{request_uri} !.*wp-admin.* rewritecond %{request_uri} !.*wp-content.* rewriterule (.+\.html?)$ $1? [nc,r=301,l] 

you can use code in document_root/.htaccess file:

rewriteengine on  rewritecond %{query_string} ^view=[^&]+ [nc] rewriterule ^(.+?)&_escaped_fragment_= /$1? [nc,ne,r=301,l] 

Comments

Popular posts from this blog

python - Healpy: From Data to Healpix map -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -