laravel 部署 前后端分离
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 . /index.html [L] </IfModule>