[英]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.