htaccess mod_rewrite 缩短为 SEO 友好的 URL
我有这个地址
http://www.nfrases.com/tag.php?id_tag=10&id_frase=508
,我想让它更短,对 SEO 更友好(我不知道......欢迎建议)http://www.nfrases.com/tag/10 /508
或 http://www.tag10name.nfrases.com/508
我需要有关如何编码的帮助,因为尝试使地址始终 是一个简单的事情http://www.nfrases.com
如果用户访问 http://nfrases.com
或 www.nfrases.com
我尝试过但失败了:(
顺便使用了此代码:
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.nfrases.com$
RewriteRule ^(.*)$ http://www.nfrases.com/$1 [R=301]
I have this address
http://www.nfrases.com/tag.php?id_tag=10&id_frase=508
that I would like to make it a lot shorter and more SEO friendly to something like (I don't know ... open to suggestions) http://www.nfrases.com/tag/10/508
or http://www.tag10name.nfrases.com/508
I need help with how to code this, because a simple thing as trying to make the address always http://www.nfrases.com
case the user goes to http://nfrases.com
or www.nfrases.com
I tried and failed :(
Used this code by the way:
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.nfrases.com$
RewriteRule ^(.*)$ http://www.nfrases.com/$1 [R=301]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
http://www.nfrases.com/tag.php?id_tag=10&id_frase=508< /a>
变成
http://www.nfrases.com/10/508
,并将其添加到您的.htaccess
未经测试。让我知道它是否适合您。
http://www.nfrases.com/tag.php?id_tag=10&id_frase=508
becomes
http://www.nfrases.com/10/508
with this in your .htaccess
Untested. Let me know if it works for you.