Link to home
Start Free TrialLog in
Avatar of sharingsunshine
sharingsunshineFlag for United States of America

asked on

Need Regex Help For Complicated Query String

I need some mod rewrite help with a regex.  This is an example url - https://www.thefrugallife.com/12all/lt.php?c=1728&m=2981&nl=1&s=c9b91a7ca200a96e668e515ecf49b34c&lid=19221&l=-http--www.theherbsplace.com/Shop_A_Z_page_1_c_28.html

I am trying to get it to redirect to the url after the last equals sign - http--www.theherbsplace.com/Shop_A_Z_page_1_c_28.html

I have 2,000 links like this all with a different url after the last equals sign.

Here is my code

RewriteCond %{REQUEST_URI} /?12all/lt\.php$
RewriteCond %{QUERY_STRING} c=(.*)$ [NC]
RewriteCond %{QUERY_STRING} m=(.*)$ [NC]
RewriteCond %{QUERY_STRING} nl=(.*)$ [NC]
RewriteCond %{QUERY_STRING} s=(.*)$ [NC]
RewriteCond %{QUERY_STRING} lid=(.*)$ [NC]
RewriteCond %{QUERY_STRING} l=-http--(.*)$ [NC]
RewriteRule ^.*$ https://%6/? [NC,L,R=301]

Open in new window


Please tell me what I am doing wrong so I can get this cleaned up for Google.

Thanks,
ASKER CERTIFIED SOLUTION
Avatar of David S.
David S.
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sharingsunshine

ASKER

that fixed it.  So you count back references from the bottom?  How would I do it different since I don't need to check for the presence of the other parameters?