2017-01-13 129 views
1

我需要Apache將所有請求都彙集到index.html文件(不包括資源請求 - js,css等),但是到/ api文件夾的任何請求需要彙集到Laravel前端控制器:/api/public/index.php將所有請求重定向到index.html EXCEPT請求到/ api文件夾

任何人都可以與我分享他們的.htaccess知識來幫助完成此任務嗎?

+1

的[重定向本站的.htaccess,但不包括一個文件夾]可能的複製(http://stackoverflow.com/questions/3414015/redirect-site-with-htaccess-but-exclude-one-folder) –

回答

0

好的,得到了​​我的答案。這是如何做到的:

1 - 發送任何請求到/ api文件夾到Laravel前端控制器。

2 - 將除此之外的任何其他文件發送到index.html文件。

RewriteEngine on 

RewriteCond %{REQUEST_URI} ^/api/ 
RewriteRule (.*) /api/public/index.php [L] 

RewriteBase/
RewriteRule ^index\.html$ - [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . /index.html [L] 
相關問題