我在以下结构中有一个网址,如
http://www.naturaflowers.com/100-fresh-cut-wholesale-flowers.html
我想重写像
这样的网址http://www.naturaflowers.com/fresh-cut-wholesale-flowers.html
我们使用"终极SEO url插件"生成SEO友好的URL。旧的URL结构是/index.php?main_page=index&cPath=category_id。我的htaccess代码如下:
RewriteEngine On
RewriteBase /
RewriteRule ^(.*)-(.*).html$ index\.php?main_page=index&cPath=$1&%{QUERY_STRING} [L]
上面提到的插件和这个htaccess代码重写 index.php?main_page = index& cPath = 100 to /100-fresh-cut-wholesale-flowers.html。现在我想 /100-fresh-cut-wholesale-flowers.html重写为 /fresh-cut-wholesale-flowers.html我的网站到处都是 htaccess。
答案 0 :(得分:0)
RewriteRule ^(/?)\d+-(.*)$ $1$2
答案 1 :(得分:0)
你的规则如下:
RewriteEngine On
RewriteBase /
RewriteRule ^[0-9]+-(.+?\.html)$ /$1 [L,R=302,NC]
RewriteRule ^(.+?)\.html$ index\.php?main_page=index&cPath=$1 [L,QSA,NC]