[英]Apache htaccess exclude specific URL from 301-redirect
On a apache system i added a redirect from the old server to the new one with this .htaccess:在 apache 系统上,我使用此 .htaccess 添加了从旧服务器到新服务器的重定向:
redirect 301 / http://www.new-domain.com/redirect.php?q=
But i want to exclude this redirect for this URL:但我想排除这个 URL 的重定向:
http://domain.com/index.php/admin/
Every request to the old admin-area having this part in the URL "/index.php/admin" shall remain on the old server and not being redirected to the new one.在 URL "/index.php/admin" 中包含此部分的旧管理区域的每个请求都应保留在旧服务器上,而不会被重定向到新服务器。
How to achieve that?如何做到这一点?
You can use mod_rewrite
rule for that instead of Redirect
that doesn't allow regex:您可以使用
mod_rewrite
规则代替不允许正则表达式的Redirect
:
RewriteEngine On
RewriteRule !^index\.php/admin http://www.new-domain.com/redirect.php?q=%{REQUEST_URI} [L,NE,R=302]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.