php - Apache Web 服务器配置给出 404 错误消息

标签 php .htaccess laravel laravel-4

伙伴们, 我一直在四处寻找,但仍然找不到解决方案。

我在 apache2.conf 上有这个

<Directory /home/pablo/htdocs/elementalguru/cuentas/idpetecuador.com/www/system/public>
    Options FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

这在 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 localhost

    ServerAdmin webmaster@localhost
    DocumentRoot /home/pablo/htdocs

    # 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>

<VirtualHost *:80>
    DocumentRoot "/home/pablo/htdocs/elementalguru/cuentas/idpetecuador.com/www/system/public"
    ServerName eguru.idpet.sys
</VirtualHost>

公用文件夹中的.htaccess文件是这样的:

<IfModule mod_rewrite.c>
    Options -MultiViews
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

但是当我尝试访问像

这样的 url 时
http://eguru.idpet.sys/clinicas

在主机文件中说明。

我收到 404 错误消息。

知道为什么吗? 提前致谢!

最佳答案

你的 mod_rewrite 启用了吗?

尝试$ a2enmod rewrite 然后重启apache。

这是 laravel/laravel .htaccess,你试过了吗?

<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>

关于php - Apache Web 服务器配置给出 404 错误消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24965876/

相关文章:

php - 是否可以将任意数据附加到 PHP 中的实际文件

php - 如何有条件地运行 for 循环,省略某些值,PHP

apache - 在 apache 2.4 中结合子文件夹的 ip 和用户身份验证限制

css - Laravel css 出现在标题标签上

database - 如何将参数传递给 Laravel DB::transaction()

php - MYSQL - 获取坐标点的最快方法

php - 如何在 Laravel 4 中查询除一个以外的所有内容?

.htaccess - 如何从 URL 中删除 index.php?

php 使用 htaccess 获取路径信息

node.js - 电子邮件验证在socioboard 4.0 中不起作用