我想为
写一个重写规则http://www.site.com/noticia/?_escaped_fragment_=noticia=/279/beto-cuevas3er-sencillo-dej-de-pensar
为:
http://www.site.com/noticia/#!noticia=/279/beto-cuevas3er-sencillo-dej-de-pensar
我试过这个但是远远不是我需要的吗?
# Enable Rewrite Engine
RewriteEngine on
#Create friendly URL
RewriteRule ^index.php?_escaped_fragment=something=yes$
index.php/#!something=yes [L]
答案 0 :(得分:1)
通过httpd.conf
启用mod_rewrite和.htaccess,然后将此代码放在.htaccess
目录下的DOCUMENT_ROOT
中:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} ^_escaped_fragment_=([^=]+)=([^&]+) [NC]
RewriteRule ^$ /%1/#!%1=%2? [L,R,NE]