【发布时间】:2018-04-27 11:20:42
【问题描述】:
我有一个 laravel 5.4 over apache centos 服务器。
文件夹结构如下: /var/www/html
index.php 包含对项目主文件夹的引用。 该项目有效,但仅使用 ip:
myip/index.php/login
而不是
myip/login
如我所愿 我尝试了很多方法来删除它,但没有运气,这是我在 /var/www/html 中的 .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]
RewriteRule ^(.*)$ index.php/$1 [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
【问题讨论】:
-
我之前发现了这篇文章,但对我没有用……甚至不需要剪掉“公共”部分
-
apache配置中
DocumentRoot是如何设置的? -
设置为 /var/www/html
标签: php laravel .htaccess routing