我需要更正下面的重写规则,以便任何调用的url将被定向到/或index.html,但如果url是用于Web服务(/ ws / controller / function),那么我想要它直接到/ws/index.php
对于我在html中的角度2我有
<base href="/">
网址格式为xxx / yyy / not#/ xx / yy
我的.htaccess是
<ifModule mod_rewrite.c>
RewriteEngine on
Options FollowSymLinks
RewriteBase /ws/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /ws/index.php?url=$1 [L,QSA]
</ifModule>
<ifModule mod_rewrite.c>
RewriteEngine On
Options FollowSymLinks
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /#/$1 [L]
</ifModule>
它工作正常,但是当用户在根目录下重新加载页面时,应用程序就会崩溃。
由于
答案 0 :(得分:2)
我认为这会有所帮助:
<ifModule mod_rewrite.c>
RewriteEngine On
Options FollowSymLinks
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !/ws/
RewriteRule ^(.*)$ index.html [L,QSA]
RewriteRule ^(ws/.*)$ ws/index.php?request=$1 [L,QSA]
</ifModule>