我正在使用laravel 5并且当我在rackspace上传项目时遇到一个问题,它在url中显示public / index.php。没有这个,我的项目就无法运作。
请帮帮我。
我的公众的共同点是: -
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
关心 Harpartapsingh
答案 0 :(得分:0)
通过将/path/to/laravel/public
文件夹本身设置为Apache / nginx中的webroot而不是/path/to/laravel
来实现此目的。有了它,以及公共文件夹中的标准.htaccess
,您应该能够访问没有public
或index.php
网址段的路线。
答案 1 :(得分:0)
从公用文件夹中复制.htaccess
文件并粘贴到根目录中
将此代码放在.htaccess
:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]