Skip to main content
Level 2
Jul 2, 2024 8:21 AM UTC
Solved

Facing Issue with rewrite rule asked by our client

Hello,

Our client has asked us to make a rewrite rule of this style

 

RewriteRule ^ /text/text/text/text-text-text-text-i%21$ https://%{HTTP_HOST}/text [L,R=301]

 

However i can not seem to get it to work, i am guessing it is because the special character, but i am not finding a solution.

I have already tried adding NE in the rules.

 

Any insight i can receive on this? I have other similar requests that i do not know how to approach either.

Like this one

 

RewriteRule ^ /text/text/text/%20?date=20190808$ https://%{HTTP_HOST}/text [L,R=301]

 

Thanks in Advance for any help provided


Best Regards.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
h_kataria
h_katariaAccepted solution
Community Advisor
Jul 2, 2024 8:51 AM UTC

It would have been helpful if you provided the exact use case. But with the two examples which you have provided, it could be done something like 

RewriteRule ^/text/(.*)$ https://%{HTTP_HOST}/text [L,R=301]

3 replies

h_kataria
Community Advisor
h_katariaCommunity AdvisorAccepted solution
Community Advisor
Jul 2, 2024 8:51 AM UTC

It would have been helpful if you provided the exact use case. But with the two examples which you have provided, it could be done something like 

RewriteRule ^/text/(.*)$ https://%{HTTP_HOST}/text [L,R=301]
Translate
arunpatidar
Community Advisor
Community Advisor
Jul 2, 2024 10:45 AM UTC

Hi @danielma16 
If you are looking for anything generic then you may need to something like below

# Generalized rewrite rule for repeated word pattern

RewriteRule ^(.+)/\1/\1/\1-\1-\1-\1-i%21$ /$1 [R=301,L]

Translate
Arun Patidar
Level 2
Jul 2, 2024 10:52 AM UTC

Hello @arunpatidar 

in this case i could get by with @h_kataria answer, but i would save your advice for another more generalized case i may encounter in the future.

Thank you so much to both of you.

Best Regards.

Translate