[英]nginx, rewrite url is not working
我的重寫URL不起作用,這是帶有重寫的Nginx配置的一部分。 感謝您的任何建議。
location / {
try_files $uri $uri/ @mylocation;
}
location @mylocation {
rewrite ^index.php?p=/profile(.*)$ /profile/ redirect;
rewrite ^.*$ /index.php last;
}
請求永遠不會到達@mylocation
,因為我認為index.php存在...
試試這個
location / {
try_files $uri $uri/ /index.php;
}
location /index.php {
if ($args ~* "^p=/profile.*") {
rewrite ^ /profile/? redirect;
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.