【发布时间】:2012-01-11 22:12:14
【问题描述】:
我有一个格式为http://www.site.com/index.php/page 的网址,想将其重写为http://www.site.com/#/page,但我似乎无法在任何地方找到答案。有人可以帮忙吗?
【问题讨论】:
标签: .htaccess url hash rewrite
我有一个格式为http://www.site.com/index.php/page 的网址,想将其重写为http://www.site.com/#/page,但我似乎无法在任何地方找到答案。有人可以帮忙吗?
【问题讨论】:
标签: .htaccess url hash rewrite
如果你只是想用# 替换index.php,你可以这样做:
RewriteRule ^/index.php/(.*) /#/$1 [NE,R]
NE 标志应该防止 mod_rewrite 转义 #
【讨论】:
/。所以RewriteRule ^/index.php/(.*) /#/$1 [NE,R]。感谢 M_M 展示了 NE 的用例。很有教育意义。
AddType text/cache-manifest .appcache RewriteEngine on RewriteCond %{HTTPS} (on)? RewriteCond %{HTTP:Host} ^(?!www\.)(.+)$ [NC] RewriteCond %{REQUEST_URI} (.+) RewriteRule .? http(?%1s)://www.%2%3 [R=301,L] RewriteRule ^/index.php/(.*) /#/$1 [NE,R]