sen*_*iwa 3 mod-rewrite redirect apache-2.2
我认为这很容易,但恐怕我无法自己解决所有问题。
我已将网站移至另一个域,并设置了一些永久重定向。但是,我想从任何重写中保留一个 URL。现在我的配置是这样的:
Redirect permanent /olduser/exception/ ???
Redirect permanent /olduser/dir/ http://newuser.domain.com/a.html
Redirect permanent /olduser/other/ http://newuser.domain.com/q.html
Redirect permanent /olduser/other/sub/ http://newuser.domain.com/t/some.html
Redirect permanent /olduser/ http://newuser.domain.com/
Run Code Online (Sandbox Code Playgroud)
当然,第一行是有问题的,因为我在最后一行将整个子目录重定向到新域。在新域上我没有权限,因为它是一个类似于 GitHub 的静态网站。
请注意,我不能简单地使用重写规则,因为旧目录不对应于新文件/目录。或者更好,我看不出我怎么能做到这一点:)
如何/olduser/exception/在不影响其他规则的情况下在旧服务器上工作?
谢谢!
就像这样:
RedirectMatch ^/olduser/(?!exception/).* http://newuser.domain.com/
Run Code Online (Sandbox Code Playgroud)
代替:
Redirect permanent /olduser/ http://newuser.domain.com/
Run Code Online (Sandbox Code Playgroud)
将所有/olduser请求 exept 模式匹配重定向/olduser/exception/到您的新域。
| 归档时间: |
|
| 查看次数: |
6006 次 |
| 最近记录: |