如何从laravel 5的url中删除public/index.php?
我使用的是laravel 5,当我在rackspace上上传我的项目时有一个问题,它在url中显示public/index.php。没有这个,我的项目就不能工作 请帮帮我 我的公众意见如下:如何从laravel 5的url中删除public/index.php?,php,.htaccess,laravel,laravel-5,Php,.htaccess,Laravel,Laravel 5,我使用的是laravel 5,当我在rackspace上上传我的项目时有一个问题,它在url中显示public/index.php。没有这个,我的项目就不能工作 请帮帮我 我的公众意见如下: <IfModule mod_rewrite.c> <IfModule mod_negotiation.c> Options -MultiViews </IfModule> RewriteEngine On # Redir
<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>
选项-多视图
重新启动发动机
#重定向尾部斜杠。。。
重写规则^(.*)/$/$1[L,R=301]
#处理前控制器。。。
重写cond%{REQUEST_FILENAME}-D
重写cond%{REQUEST_FILENAME}-F
重写规则^index.php[L]
关于
Harpartapsingh您可以通过将
/path/to/laravel/public
文件夹本身设置为Apache/nginx中的webroot,而不是/path/to/laravel
。有了它,再加上公用文件夹中的标准.htaccess
,您应该能够在不使用public
或index.php
URL段的情况下访问路由 从公用文件夹复制.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]
选项-多视图
重新启动发动机
#如果不是文件夹,则重定向尾部斜杠。。。
重写cond%{REQUEST_FILENAME}-D
重写规则^(.*)/$/$1[L,R=301]
#处理前控制器。。。
重写cond%{REQUEST_FILENAME}-D
重写cond%{REQUEST_FILENAME}-F
重写规则^index.php[L]
机架空间的可能副本不允许我的域直接重定向到公用文件夹。你能用SSH连接到服务器并简单地符号链接
httpdocs->public
?i、 e.ln-s公共httpdocs
。假设您的项目不在docroot中(我认为这就是Alan的意思)。