【发布时间】:2014-10-10 17:01:40
【问题描述】:
我已经为使用 html5 路由的 AngularJs 应用程序编写了这个重写规则。
重写的url是这样的:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^.*\.(jpg|css|js|gif|png|html|woff)$
RewriteRule ^ index.html [L]
我希望不重写包含路径 /old/ 和路径 /images/ 的所有 URL!
有人可以帮助我,我尝试像这样添加重写条件:
RewriteCond %{REQUEST_URI} !^/old/
但它不起作用!
问候, 洛伦佐
更新
如果您使用带有路由的 AngularJS,请在 <a> 元素上使用 target="_self",该元素在同一域中具有链接但不在角度路由下!
【问题讨论】:
标签: angularjs apache .htaccess mod-rewrite url-rewriting