laravel 部署 前後端分離
阿新 • • 發佈:2019-01-02
1、 iis伺服器配置(web.config):
<configuration> <system.webServer> <rewrite> <rules> <rule name="Rewrite Text Requests" stopProcessing="true"> <match url=".*" /> <conditions> <add input="{HTTP_METHOD}" pattern="^GET$" /> <add input="{HTTP_ACCEPT}" pattern="^text/html" /> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> </conditions> <action type="Rewrite" url="/index.html" /> </rule> <rule name="api" stopProcessing="true"> <match url="^api/" /> <action type="Rewrite" url="public/index.php" /> </rule> <rule name="sitemap" stopProcessing="true"> <match url="^sitemap.xml" /> <action type="Rewrite" url="sitemap.xml" /> </rule> </rules> </rewrite> <modules runAllManagedModulesForAllRequests="true"> <remove name="WebDAVModule"/> </modules> <handlers> <remove name="WebDAV" /> </handlers> </system.webServer> </configuration>
2、 apache伺服器 .htaccess
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.html$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^api\/[a-z]*$ /public/index.php [L] RewriteRule . /index.html [L] </IfModule>