我想写一个重写规则
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]

最佳答案

通过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]

关于ajax - _escape_fragment_的重写规则,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/15664861/

10-13 00:30