redirect - nginx重写文件夹的重定向

标签 redirect nginx rewrite

所有...

我正在尝试在Nginx中做一些事情来重定向文件中的所有调用

/images/


成为:

/assets/images/


有人可以帮我制定重写规则吗?赋予301永久移动状态?

最佳答案

这是使用较新版本的Nginx的首选方法:

location ~ ^/images/(.*) {
    return 301 /assets/images/$1;
}


有关更多信息,请参见https://www.nginx.com/blog/creating-nginx-rewrite-rules/

关于redirect - nginx重写文件夹的重定向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18305189/

相关文章:

networking - 将对外部 IP 的请求重定向到本地 IP

javascript - 最后使用当前域重定向 - Wordpress 插件

php - Php+MySql应用程序响应慢

ssl - 设置 nginx 以使用多个 ssl 证书而无需多个服务器

api - flask 重写网址

asp.net - 重定向页面而不丢失 SEO

regex - 301重定向将所有空格替换为连字符

python - nginx 和 uwsgi 服务器中 uwsgi 模块的区别

php - 如何将 example.com/index.php#anchor 的 URL 重写为 example.com/anchor?

php - Apache Rewrite 规则困惑