0

我有很多最后包含 13 位数字代码的 url,看起来像……</p>

http://www.example.com/a-test-title-1/1579845887463/
http://www.example.com/a-test-title-2/2356668749876/
http://www.example.com/a-test-title-3/5689874598235/

我想删除这些数字,使网址看起来像……</p>

http://www.example.com/a-test-title-1/
http://www.example.com/a-test-title-2/
http://www.example.com/a-test-title-3/

我已经在我的 htaccess 文件中尝试过这个,RewriteRule [0-9]{10,15} $1 [R=301,L]但它不起作用,我不知道该怎么办?

有人有想法么?

谢谢,

詹姆士

4

2 回答 2

0

你可以用这个 RewriteRule 砍掉数字

RewriteBase /
RewriteRule ^(.+?/)\d+/$ $1 [R,L]
于 2013-03-11T14:17:58.710 回答
0

我写了这个似乎工作正常。谁能发现任何明显的错误?

RewriteCond %{REQUEST_URI} (.*)\/[0-9]{10,}\/$
RewriteRule .* %1\/ [R=301,L]`
于 2013-03-11T14:35:40.520 回答