[英]remove directory url for framework with htaccess
我有此代碼.htaccess為laravel框架工作
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /testing/public/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?$1 [NC,L]
</IfModule>
哪個工作正常,但框架中的問題我去了example.com/testing網站
問題laravel框架讀/測試為路線
所以我已經測試了所有路線
所以問題是:如何使apache在不進行“ / testing”的情況下發送PHP路由?
只需從范圍中排除所有與/ testing路徑匹配的請求即可。 查看htaccess文檔
RewriteEngine On
RewriteBase /testing/public/
RewriteCond %{REQUEST_URI} !^/testing$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?$1 [NC,L]
但是無論如何,您都不應該這樣做 ,您會將傳入的請求重定向到/testing/public/index.php
。
您必須按照http://laravel-recipes.com/recipes/25/creating-an-apache-virtualhost中的說明配置直接指向laravel應用程序中/public
文件夾的虛擬主機
這就是為什么您應該這樣做 : https : //security.stackexchange.com/questions/56736/is-web-app-safe-in-not-public-folder
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.