[英]htaccess mod_rewrite Shorten to a SEO friendly URL
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
我想让它变得更短,更喜欢SEO(我不知道......接受建议)
http://www.nfrases.com/tag/10/508
或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 :( 我需要有关如何编写代码的帮助,因为一个简单的事情就是试图使地址始终是
http://www.nfrases.com
案例,用户访问http://nfrases.com
或www.nfrases.com
我试过失败了:(
Used this code by the way: 顺便使用此代码:
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.nfrases.com$
RewriteRule ^(.*)$ http://www.nfrases.com/$1 [R=301]
http://www.nfrases.com/tag.php?id_tag=10&id_frase=508 http://www.nfrases.com/tag.php?id_tag=10&id_frase=508
becomes 变
http://www.nfrases.com/10/508 http://www.nfrases.com/10/508
with this in your .htaccess 在你的.htaccess中有这个
Options +FollowSymlinks -MultiViews
RewriteEngine On
RewriteRule ^([0-9]*)/(.*)/?$ /tag.php?id_tag=$1&id_frase=$2 [L,QSA]
Untested. 未经测试。 Let me know if it works for you.
请让我知道这对你有没有用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.