I want to redirect:
https://latestmodapks.com/pt/download-de-dados-gta-4-apk-obb-para-android-e-ios/anythinghere
OR
https://latestmodapks.com/pt/download-de-dados-gta-4-apk-obb-para-android-e-ios/anythinghere/
to
https://latestmodapks.com/pt/download-de-dados-gta-4-apk-obb-para-android-e-ios/download
Replace (anythinghere or anythinghere/ with download)
After trying a bit, I think this code should work:
RewriteRule https://latestmodapks.com/(.*?)/(.*?)/(.*) https://latestmodapks.com/$1/$2/download [R=301,NC,L]
But this doesn't seem to work at all. What am I missing here? Using openlitespeed.
CodePudding user response:
You don't match scheme, port or hostname etc in RewriteRule
.
Use your rule like this:
RewriteRule ^(pt/.*/)[^/] /?$ /$1/download [R=301,NC,L,NE]
Breakup:
(.*/)
will match any path starting withpt/
then longest possible match ending with/
in capture group #1.[^/]
will match 1 of any char that is not/
(last path component)- Target is
/$1/download
that replaces only last path component withdownload