Angularjs 使用apachemod_rewrite在/#
我需要Apache通过将HTTP查询字符串从 /?foo=bar 它适用于Angularjs 使用apachemod_rewrite在/#,angularjs,apache,.htaccess,mod-rewrite,Angularjs,Apache,.htaccess,Mod Rewrite,我需要Apache通过将HTTP查询字符串从 /?foo=bar 它适用于/,但也重写了: /hello?foo=bar 到 i、 e.它从重写的目的地删除路径/hello。我希望Apache将/hello?foo=bar重写为/hello/#/?foo=bar 使用角度html5模式是不可能的,因为我必须支持IE9及以下版本 谁能帮我找到一个更好的重写规则,它只适用于/ 谢谢 这似乎成功了: <Location /> RewriteEngine on # Put a /#
/
,但也重写了:
/hello?foo=bar
到
i、 e.它从重写的目的地删除路径/hello
。我希望Apache将/hello?foo=bar
重写为/hello/#/?foo=bar
使用角度html5模式是不可能的,因为我必须支持IE9及以下版本
谁能帮我找到一个更好的重写规则,它只适用于/
谢谢 这似乎成功了:
<Location />
RewriteEngine on
# Put a /# in front of the query string
RewriteCond %{REQUEST_URI} ^/$
RewriteCond "%{QUERY_STRING}" "^(.+)"
RewriteRule "/" "/#/?%1" [R=302,NE]
</Location>
重新启动发动机
#在查询字符串前面加一个/#
重写cond%{REQUEST_URI}^/$
重写第二个“%{QUERY_STRING}”^(+)
重写规则“/”/#/?%1“[R=302,NE]
/hello?foo=bar
/#/?foo=bar
<Location />
RewriteEngine on
# Put a /# in front of the query string
RewriteCond %{REQUEST_URI} ^/$
RewriteCond "%{QUERY_STRING}" "^(.+)"
RewriteRule "/" "/#/?%1" [R=302,NE]
</Location>