Home > Software engineering >  Rewriterules 301 with round brackets into the URL it's not working
Rewriterules 301 with round brackets into the URL it's not working

Time:05-27

I have a problem with a Rewriterule that it's not working. It's something like this:

RewriteRule ^/es/rootpage/specific-page-(something)(.*).html$ https://website.com/es/another-root-page/specific-something$1 [NC,L,R=301,ENV=REDIRECTCACHE:1]

When I try to visit the first link it redirects me on: https://website.com/es/another-root-page/specific-page-(something) instead of https://website.com/es/another-root-page/specific-something.

What I've tried to do is put an escape character (the backslash) this way \(something\)(.*).html but it's not worked at all. I've tried to use the encoded ASCII character for the rounded brackets and still nothing.

Do you have any advice?

CodePudding user response:

I can confirm that the "\" character works well as a escape character for the vhost RewriteRule.

The problem was that I've used this command to restart the dispatcher machine so it was extremely slow:

apachectl -k graceful

So just do a "hard" restart or wait enough time.

I hope that this info will help someone else with similar issues!

  • Related