Greetings, gentlemen.

Problem: they migrated from Drupal to their own engine and opened up a whole series of jambs. One of them does not work out. On one of the pages was a comment module. Each comment received its own unique url and, in fact, contained a duplicate main page. Total, it turned out to accumulate the following doubles:

  • pagetitle%26post%3D-29647723_37
  • pagetitle%26post%3D-34234235_37
  • pagetitle%26post%3D-23425623_37

How in one fell swoop are all pages with pagetitle%26 ending in this pagetitle%26 ... redirecting (301) to the only url that works today?

  • Do you have links right here, with% 26,% 3D? - istem

1 answer 1

It can be something like this if the URL (without coded characters) is :

 RewriteCond %{QUERY_STRING} ^pagetitle [NC] RewriteRule ^(.*)\?*$ /$1? [R=301,L] 

If there are coded characters try to play with the NE (do not escape the URI during the output)