gpt4 book ai didi

.htaccess - 从查询字符串中删除字符

转载 作者:行者123 更新时间:2023-12-05 01:21:47 26 4
gpt4 key购买 nike

我需要重定向

http://example.com/page/?Id=1253-23098-

http://example.com/page/1253-23098

此重定向还包括从查询字符串末尾删除“-”。

我做的是

RewriteEngine On
RewriteCond %{REQUEST_URI} ^/page/$
RewriteCond %{QUERY_STRING} ^Id=([0-9\-\0-9]*)$
RewriteRule ^(.*)$ http://example.com/page/%1? [L,R=301]

将我重定向到

http://example.com/page/1253-23098-

我需要从查询字符串中删除“1253-23098”之后的所有内容。

我在谷歌上搜索了过去 3-4 个小时,但似乎没有任何效果。感谢您的帮助。

最佳答案

您可以使用:

RewriteEngine On
RewriteCond %{QUERY_STRING} ^Id=(\d+-\d+) [NC]
RewriteRule ^page/?$ page/%1? [NC,L,R=301]

关于.htaccess - 从查询字符串中删除字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32369933/

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