【发布时间】:2018-05-10 11:23:18
【问题描述】:
我正在使用 Laravel 和 Vagrant。问题是当我尝试访问http://ipadress/index.php 时,它会打开页面,但是当我尝试访问http://192.168.10.167/index.php/admin 时,它说在服务器上找不到请求url。但是当我输入http://192.168.10.167/index.php/admin/login 时,它会打开 url 地址。我认为问题出在 mod rewrite 或 .htaccess 上,但我不知道到底是什么。我在 vagrant 上的本地 na nginx 上使用 apache。
这是我当前的 .htaccess
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
这是我的 000-default.conf,我使用的是 mint 18.3
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
ServerName kris.dev
ServerAdmin webmaster@localhost
DocumentRoot /home/kristian/public_html/core-cms/public
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
vim: 语法=apache ts=4 sw=4 sts=4 sr noet
【问题讨论】:
-
添加一些要处理的东西,比如你的代码,没有它我们看不到我们正在帮助修复什么