[英]How do I rewrite URLs with Nginx admin / Apache / Wordpress
[英]how to correct rewrite nginx + apache urls
我有网站(前端-nginx,后端-(apache + php)),这是nginx配置文件
server {
listen *:80;
server_name website.plus www.website.plus;
access_log /var/log/nginx/access.log;
location / {
proxy_redirect off;
proxy_pass http://127.0.0.1:81/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_connect_timeout 120;
proxy_send_timeout 120;
proxy_read_timeout 180;
}
}
阿帕奇
<VirtualHost 127.0.0.1:81>
ServerName website.plus
ServerAlias www.website.plus
ServerAdmin webmaster@localhost
DocumentRoot /var/www/website
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
并有这个网址
website.plus/tag.php?tag=cat
website.plus/search.php?search_content=cat
website.plus/view.php?image=LhUId4avpxVZK
请帮助我,如何更改(重写)网址
website.plus/tag/cat
website.plus/search/cat
website.plus/view/LhUId4avpxVZK
谢谢
试试这个(未试用):
rewrite ^tag.php?tag=(.*) tag/$1;
rewrite ^search.php?search_content=(.*) search/$1;
rewrite ^view.php?image=(.*) view/$1;
我认为这很清楚(包含有关Nginx重写的文档 ),但是如果您有任何疑问,请提出!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.