I am trying to define rewrite rules for about 50 pages with the following URL structure:
/wiki/Category:Title
I have tried the following:
location /wiki/Category {
rewrite ^/wiki/Category:Title$ https://to.some.where permanent;
rewrite ^/wiki/Category\:Title$ https://to.some.where redirect;
rewrite ^/wiki/(.*):(.*)$ https://to.some.where permanent;
rewrite ^/wiki/(.*)\:(.*)$ https://to.some.where permanent;
rewrite ^/wiki/Category:(.*)$ https://to.some.where permanent;
rewrite ^/wiki/Category\:(.*)$ https://to.some.where redirect;
rewrite ^/wiki/(.*)$ https://to.some.where permanent;
}
location /wiki/ {
rewrite ^/wiki/Category:Title$ https://to.some.where permanent;
rewrite ^/wiki/Category\:Title$ https://to.some.where redirect;
rewrite ^/wiki/(.*):(.*)$ https://to.some.where permanent;
rewrite ^/wiki/(.*)\:(.*)$ https://to.some.where permanent;
rewrite ^/wiki/Categor(.*)$ https://to.some.where permanent;
rewrite ^/wiki/Category\:(.*)$ https://to.some.where redirect;
rewrite ^/wiki/(.*)$ https://to.some.where permanent;
}
All these options result in a 403. The last rule should catch everything, but it doesn't.
I can remove the colon from the URL, and it works. However, if I add the ":", it stops working.
Yes, Rewrite is working fine for several hundred other rules. I am using curl, external website checker, and Chrome with network cache disabled to check the URLs. My current environment is:
Ubuntu 24.04 (LTS) x64
Nginx 1.26.2 with OpenSSL 3.0.13
WordOps v3.22.0
Any thoughts or suggestions?
tia