gpt4 book ai didi

apache - 如何将所有 url 重定向到 apache 中的新域(除了一个)

转载 作者:行者123 更新时间:2023-12-02 09:51:22 25 4
gpt4 key购买 nike

我需要将一个网站上的所有内容重定向到新域(一条路径除外)。

因此,domain.com/anything 需要转到 newdomain.com/anything。

但我不希望domain.com/services/xml 重定向。

我尝试了很多条件,但没有任何效果。它总是最终重定向它,或者将它重定向到新域上的其他一些奇怪的路径。

这不起作用:

RewriteCond %{REQUEST_URI} !^/services/xml$
RewriteRule ^(.*)$ http://www.newdomain.com/$1 [L,R=301]

感谢任何帮助。谢谢。

最佳答案

感谢我与 Ansari 的交谈以及托管公司的一些帮助,我明白了这一点。问题似乎是网址被重写为index.php,然后又被重定向。所以:

  RewriteCond %{REQUEST_URI} !^/services/xmlrpc
RewriteCond %{REQUEST_URI} !index\.php$ [NC]
RewriteRule ^(.*)$ http://www.wikiweightscore.com/$1 [L,R=301]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ index.php?q=$1 [QSA]

这适用于我想要的确切用例。

关于apache - 如何将所有 url 重定向到 apache 中的新域(除了一个),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10629430/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com