我必须将某些链接重定向到标准的链接,如:
/lang/news1
/lang/news2
/lang/news3 to /lang/news.html
Now i don't want to set redirect 301 directly on htaccess (i have 500 links)
and i read the possibility to create a rewritemap and a rewrite rule for the map, but how?
我在互联网上阅读但我不明白该怎么做。
建议?
加布里埃尔
答案 0 :(得分:0)
我建议把这样的东西放到你的.htaccess文件中:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /lang/
# redirect everything looks like `news[digits]` to `news.html`
# this will NOT change the request url
RewriteRule ^news([0-9]{1,})$ news.html [L]
</IfModule>
您的主机服务器当然必须支持mod_rewrite。