我看到了很多示例,并尝试了很多解决方案,但都没有成功! 我想把我的项目与Apache的Ubuntu服务器。从URL删除index.php,Laravel 5.2
一切其确定当我这样做:
"/MYEXAMPLE/public/index.php/dashboard"
但我想:
"/MYEXAMPLE/public/dashboard"
而且有问题!
“在此服务器上未找到请求的URL/MYEXAMPLE/public/dashboard。”
我Apache服务器具有德mod_rewrite的。
我的项目文件夹为:
- MYEXAMPLE
--------- server.php
--------- public
----------------.htaccess.php
----------------.index.php
---------------- views
我.htaccess.php:
<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]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
的index.php:
<?php //
require __DIR__ . '/../bootstrap/autoload.php';
$app = require_once __DIR__ . '/../bootstrap/app.php';
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
$response = $kernel->handle(
$request = Illuminate\Http\Request::capture()
);
$response->send();
$kernel->terminate($request, $response);
我不想删除我的公共文件夹的意见!当我使用wamp服务器时,一切正常,我不需要在URL处使用index.php。现在我想使用Ubuntu的服务器,但该网址的不工作,因为我需要的index.php
其他的例子:如果我访问
/MYEXAMPLE/public/
OR
/MYEXAMPLE/public/index.php
它根据需要前往主页。问题是他在什么时候想改变到其他页面!
任何解决问题的建议?为什么一切正常,运行wamp,当我尝试使用Ubuntu服务器时,我需要URL处的index.php?
在此先感谢
Laravel的文档根目录应该是公共文件夹。阅读安装说明。 – Blake
[无法从laravel url中删除index.php的可能重复?在Ubuntu的14.04](http://stackoverflow.com/questions/36001521/unable-to-remove-index-php-from-laravel-url-in-ubuntu-14-04) –