Regex 重定向301:如何从Nginx转换到Apache
我需要将一个网站从Nginx web服务器移动到Apache。我成功地转换了除了两条与传统URL兼容所需的规则之外的所有内容(该网站以前是用ASP开发的,然后用PHP重写的) 这些规则是:Regex 重定向301:如何从Nginx转换到Apache,regex,apache,nginx,Regex,Apache,Nginx,我需要将一个网站从Nginx web服务器移动到Apache。我成功地转换了除了两条与传统URL兼容所需的规则之外的所有内容(该网站以前是用ASP开发的,然后用PHP重写的) 这些规则是: location /images/index.asp { return 301 $scheme://$server_name/image-library?$args; } 它将请求重定向到 以及: location~^/images/(?[0-9]+)/index.asp{ 返回301$scheme
location /images/index.asp {
return 301 $scheme://$server_name/image-library?$args;
}
它将请求重定向到
以及:
location~^/images/(?[0-9]+)/index.asp{
返回301$scheme://$server\u name/image library?img\u year=$year&$args;
}
它将请求重定向到
你能帮我写下正确的RedirectMatch 301规则吗?…与此同时,我找到了一个适合我的解决方案:第一条规则可以翻译为:
RewriteRule ^/images/index.asp https://www.domain.ext/image-library [R=301,QSA]
第二个是:
RewriteRule ^/images/([0-9]+)/index.asp https://www.domain.ext/image-library?img_year=$1 [R=301,QSA]
你试过什么?见和。
RewriteRule ^/images/([0-9]+)/index.asp https://www.domain.ext/image-library?img_year=$1 [R=301,QSA]