【发布时间】:2016-09-23 23:05:57
【问题描述】:
我刚刚将 laravel 安装到 /admin/recurring 但后来我发现所有的商品都是公开的/ 如何将所有流量指向 /admin/recurring/foo/bar/123 将请求实际调用到 /admin/recurring/public/foo/bar/123
这是我尝试过的:
<IfModule mod_rewrite.c>
RewriteEngine On
#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#This last condition enables access to the images and css folders, and the robots.txt file
RewriteCond $1 !^(index\.php|public|images|robots\.txt|css)
RewriteRule ^(.*)$ public/index.php/$1 [L]
</IfModule>
但这不起作用。它给了我一个抱歉,找不到您要查找的页面。在 Laravel 5.3 中
【问题讨论】:
-
您不需要对 htaccess 文件进行任何更改。 public 下的 Index.php 已经设计用于处理请求。您需要做的就是将您的域指向公共文件夹(等... /admin/recurring/public)。然后你可以定义你所有的路线,这里解释laravel.com/docs/5.3/routing
-
我做不到,我有一个完整的网站围绕它
-
如果有帮助请查看此帖子laravel.io/forum/…
-
@H.Kontodios 我检查了它,但我没有看到明确的答案。虽然内容丰富。
-
FallbackResource /admin/recurring/public/index.php 有点像 laravel,但问题是 laravel 在compiled.php 中显示 NotFoundHttpException
标签: php apache .htaccess laravel mod-rewrite