Php 在同一服务器上为angular 2应用程序和web服务重新写入规则
我需要更正下面的重写规则,以便调用的任何url都将被定向到/或index.html,但是如果url是用于web服务(/ws/controller/function),那么我希望它定向到/ws/index.php 对于html中的angular 2,我有Php 在同一服务器上为angular 2应用程序和web服务重新写入规则,php,apache,.htaccess,angular,ngroute,Php,Apache,.htaccess,Angular,Ngroute,我需要更正下面的重写规则,以便调用的任何url都将被定向到/或index.html,但是如果url是用于web服务(/ws/controller/function),那么我希望它定向到/ws/index.php 对于html中的angular 2,我有 <base href="/"> url的格式为xxx/yyy/not#/xx/yy 我的.htaccess是 <ifModule mod_rewrite.c> RewriteEngine on Options Fol
<base href="/">
url的格式为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>
重新启动发动机
选项如下符号链接
重写基/ws/
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则^(.*)$/ws/index.php?url=$1[L,QSA]
重新启动发动机
选项如下符号链接
重写基/
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则^(.*)$/#/$1[L]
它可以正常工作,但当用户在根目录以外的任何位置重新加载页面时,应用程序就会崩溃
谢谢我想这会有帮助:
<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>
重新启动发动机
选项如下符号链接
重写基/
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写cond%{REQUEST_URI}/ws/
重写规则^(.*)$index.html[L,QSA]
重写规则^(ws/*)$ws/index.php?请求=$1[L,QSA]
为什么web服务有一个URL,应用程序有另一个URL?因为我的单页web应用程序和web服务位于同一台服务器上。