troyer
troyer

Reputation: 89

Nginx rewrite rule with special character and Regex

We have URLs that contains #! in their structure. I would like them to be redirected.

From:

/#!/about/
/#!/about/example/

To:

/about/
/about/example/

I tried this rule, but it didn't work:

rewrite ^([\/][#][!][\/])(.+[\/])(.+[\/])$ /$2$3 permanent;

Upvotes: 2

Views: 6393

Answers (1)

Sam
Sam

Reputation: 20486

Try this much simpler expression:

rewrite ^/\#!/(.*)$ /$1 permanent;

Upvotes: 2

Related Questions