不平行目录的 htaac​​cess 文件重定向

发布于 2024-10-20 04:10:37 字数 628 浏览 0 评论 0 原文

我需要向我的 .htaccess 文件添加一条规则来执行此操作:

从旧域转到: http://www.hikingsanfrancisco.com/outdoors/trees/tanoak.php

到一个新域,如下所示: http://www.comehike.com/outdoors/trees/129/Tanoak

我添加了这样的规则: RewriteRule http://www.hikingsanfrancisco.com/outdoors/trees/tanoak.php http://www.comehike.com/outdoors/trees/129/Tanoak

但它不起作用:(

关于如何完成我需要做的事情有什么想法吗?

I need to add a rule to my .htaccess file to do this:

Go from the old domain which was this:
http://www.hikingsanfrancisco.com/outdoors/trees/tanoak.php

To a new domain which will be this:
http://www.comehike.com/outdoors/trees/129/Tanoak

I have added a rule like this:
RewriteRule http://www.hikingsanfrancisco.com/outdoors/trees/tanoak.php http://www.comehike.com/outdoors/trees/129/Tanoak

But it doesn't work :(

Any idea on how to accomplish what I need to do?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

旧夏天 2024-10-27 04:10:37

对于那些无法获得类似功能的人,请尝试以下操作:

RewriteRule ^outdoors/swift_bird.php http://www.comehike.com/outdoors/birds/bird.php?bird_id=1 [R,L]

我知道路径与问题的项目不同。但没关系。不同之处似乎是将 [R,L] 放在行尾。这是来自其他地方的建议,所以我不确定它到底做了什么,但它使重定向起作用了:)

For those who can' get a similar thing to work, try something like this:

RewriteRule ^outdoors/swift_bird.php http://www.comehike.com/outdoors/birds/bird.php?bird_id=1 [R,L]

I know the paths are of different items than the question. But it doesn't matter. The difference seemed to be putting the [R,L] at the end of the line. It was a suggestion from elsewhere, so I am not sure what it does exactly, but it made the redirect work :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文