【发布时间】:2017-01-14 02:17:56
【问题描述】:
似乎漂亮的 URL 不适合我。我已经尝试了所有我知道的东西,当您尝试 http://wasamar.com.ng/login 时,它会给出 404 Not Found 的响应,但 http://wasamar.com.ng/inde.php/login 没问题,我已经编辑了我的 public/ 目录的 .htaccess strong> 文件到这个:
<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]
</IfModule>
这是 /etc/apache2/sites-available/000-default.conf
<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 wasamar.com.ng
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/wasamar/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
</VirtualHost>
我做错了什么?
【问题讨论】:
-
你的 Apache 虚拟主机的根目录是什么?
-
在哪里可以查到?是你说的 /etc/apache2 吗?
-
取决于您的操作系统,例如
/etc/apache2/sites-available/用于 Debian。 -
Ubuntu 服务器 16.04 是的,它是 /etc/apache2/sites-available/
-
那么...你的 Apache 虚拟主机的根目录是什么?
标签: php apache .htaccess laravel pretty-urls