在.htaccess中应用重定向/重写的问题

发布于 2025-01-25 01:44:54 字数 1024 浏览 1 评论 0原文

我被要求为一个与另一个网站相结合的网站创建一些重定向。我问题的一部分是原始的和新的URL路径不匹配。将根域重新指导到新的不是问题,而是一个单个重定向的问题,因为它继续附加了根域。相反,我可以将所有个人重定向起作用,而不是根源。

我尝试了标准重定向,还使用了重写规则和组合。我发布的几个重定向语句。

我相信我的主要问题是,尽管主要域匹配,但客户端希望更改为子路径。示例是:

Site1.com/ https://www.Site2.com/ProductCore1/

Site1.com/index.php/our-products/ProductCore1 https://www.Site2.com/ProductCore1/

Site1.com/index.php/our-products/ProductCore1/microsoft-excel https://www.Site2.com/ProductCore1-for-excel/

Site1.com/index.php/our-products/mProductCore1/sap-business-objects https://www.Site2.com/ProductCore1-for-sap-business-objects/

Site1.com/index.php/corporate-menu/contact https://www.Site2.com/contact/

每次尝试时,site1.com的根域都会正确地重定向到site2.com/productcore1,但是site1.com/index.php/our-products/productcores/productcore1/microsoft-excel-excel-excel- ://www.site2.com/productcore1/productcore1-for-excel/“ rel =“ nofollow noreferrer”> https://www.site2.com/productcore1/productcore1/productcore1-for-excel/ 。它添加了额外的productCore1/。

任何帮助将不胜感激。干杯

I've been asked to create some redirects for a website that's being moved and combined with another site. Part of my issue is that the original and new url paths don't match. Not an issue to re-direct the root domain to the new, but then none of the individual redirects work because it continues to append the root domain. The opposite is also true where I can have all the individual redirects work, but not the root.

I've tried standard Redirects and also using a rewrite rule and a combination. A couple of the redirect statements I've put in.

I believe my primary issue is that although the primary domain matches, the client wants to change to sub paths. Examples are:

Site1.com/ https://www.Site2.com/ProductCore1/

Site1.com/index.php/our-products/ProductCore1 https://www.Site2.com/ProductCore1/

Site1.com/index.php/our-products/ProductCore1/microsoft-excel https://www.Site2.com/ProductCore1-for-excel/

Site1.com/index.php/our-products/mProductCore1/sap-business-objects https://www.Site2.com/ProductCore1-for-sap-business-objects/

Site1.com/index.php/corporate-menu/contact https://www.Site2.com/contact/

Every time I try, the root domain of site1.com properly redirects to site2.com/ProductCore1, but Site1.com/index.php/our-products/ProductCore1/microsoft-excel redirects to https://www.Site2.com/ProductCore1/ProductCore1-for-excel/. It adds in the extra ProductCore1/.

Any help would be greatly appreciated. Cheers

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文