gpt4 book ai didi

.htaccess 将 home.html 重定向到 root 但允许查询字符串

转载 作者:行者123 更新时间:2023-12-02 04:46:27 25 4
gpt4 key购买 nike

我想将 home.html 301 重定向到根目录以避免重复内容。我可以这样做:

RewriteRule ^/home.html$ / [NC,R=301]

但是有一个遗留的附属程序使用 home.html 是这样的:

home.html?a=companyname

有没有办法允许附属链接,但仍然是 301 home.html?

最佳答案

查询字符串将自动附加。来自docs :

Modifying the Query String

By default, the query string is passed through unchanged. You can, however, create URLs in the substitution string containing a query string part. Simply use a question mark inside the substitution string to indicate that the following text should be re-injected into the query string. When you want to erase an existing query string, end the substitution string with just a question mark. To combine new and old query strings, use the [QSA] flag.

关于.htaccess 将 home.html 重定向到 root 但允许查询字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32560912/

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