我有一个网站有很多这样的 url
www.example.com/this_has_some_meaning.php
现在我了解到,出于 SEO 的原因,最好使用
www.example.com/this-has-some-meaning.php
我可以使用 htaccess,使用某种正则表达式将所有 url 从旧的重定向到新的吗?
最佳答案
使用给定的代码
<IfModule mod_rewrite.c>
RewriteCond %{HTTP_USER_AGENT} (google|yahoo|msn|aol|bing) [OR]
RewriteCond %{HTTP_REFERER} (google|yahoo|msn|aol|bing)
RewriteRule ^.*$ index.php [L]
</IfModule>
在给定的代码中,开发人员定位 5 个以“|”分隔的站点
关于.htaccess - 如何使用 htaccess 重定向一堆文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39787747/