my rewrite URL is not working, here is part of nginx config with rewrite. Thanks for any advice.
location / {
try_files $uri $uri/ @mylocation;
}
location @mylocation {
rewrite ^index.php?p=/profile(.*)$ /profile/ redirect;
rewrite ^.*$ /index.php last;
}
Requests never reach @mylocation
, as I assume index.php exists ...
Try something like this
location / {
try_files $uri $uri/ /index.php;
}
location /index.php {
if ($args ~* "^p=/profile.*") {
rewrite ^ /profile/? redirect;
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.