Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我希望将一个字母和最多两个数字(a12,d17)的模式重定向到(/home#d17,/home#a12)。
大约会有 60 个这样的重定向,所以我希望一个模式可以让事情变得更容易。有任何想法吗?
Redirect 301 /a1 /home#a1 Redirect 301 /d13 /home#d13
尝试以下操作: Redirect 301 /([a-z][0-9]{1,2})$ /home#$1
Redirect 301 /([a-z][0-9]{1,2})$ /home#$1
(
[a-z]
[0-9]{1,2}
)
$
我们将用于引用$1第 1 组。
$1
试试这个 htaccess 代码:
RewriteEngine On RewriteRule ^([a-z0-9])$ /home#$1 [R=301]