Facing Issue with rewrite rule asked by our client | Community
Skip to main content
Level 2
July 2, 2024
Solved

Facing Issue with rewrite rule asked by our client

  • July 2, 2024
  • 2 replies
  • 845 views

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.
Best answer by h_kataria

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]

2 replies

h_kataria
Community Advisor
h_katariaCommunity AdvisorAccepted solution
Community Advisor
July 2, 2024

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]
arunpatidar
Community Advisor
Community Advisor
July 2, 2024

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]

Arun Patidar
Level 2
July 2, 2024

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.