如何从Laravel 5中的URL删除public/index.php? [英] How to remove public/index.php from url in laravel 5?

查看:108
本文介绍了如何从Laravel 5中的URL删除public/index.php?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用laravel 5,将我的项目上传到机架空间时出现一个问题,它在URL中显示public/index.php.没有这个,我的项目将无法正常工作.

I am using laravel 5 and having one problem when i upload my project on rackspace it is showing public/index.php in the url. Without this my project is not working.

请帮助我.

我的公共需求是这样的:-

Htacesss of my public is this :-

<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

With regards Harpartapsingh

推荐答案

从公用文件夹复制.htaccess文件,然后粘贴到根目录中 此代码位于.htaccess中:

copy your .htaccess file from your public folder and paste in your root directory with this code inside .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]

这篇关于如何从Laravel 5中的URL删除public/index.php?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆