【问题标题】:nette, localhost, 404 on subfoldersnette, localhost, 404 在子文件夹上
【发布时间】:2015-09-18 11:21:44
【问题描述】:

我正在使用 XAMPP 在 localhost 上运行 nette 框架。当我转到索引页面时,一切都很好,但是当我点击某些子页面的 URL 时,我得到 404 错误。

我在 apache (httpd-vhosts.conf) 中为我的文档文件夹设置了别名:

Alias /documents "C:/Users/username/Documents"
<Directory "C:/Users/username/Documents">
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All
    Order allow,deny
    Allow from all
    Require all granted
</Directory>

当我使用 URL http://localhost/documents/git/projectXY/www/ 进入索引页面时,一切正常

但是当我点击带有 URL http://localhost/documents/git/projectXY/www/customer/sign/in 的 Sing in 按钮时,我收到 404 错误

在 www 文件夹中我有 htaccess:

# Apache configuration file (see httpd.apache.org/docs/current/mod/quickreference.html)

# disable directory listing
<IfModule mod_autoindex.c>
    Options -Indexes
</IfModule>

# enable cool URL
<IfModule mod_rewrite.c>
    RewriteEngine On
    # RewriteBase /

    # prevents files starting with dot to be viewed by browser
    RewriteRule /\.|^\. - [F]

    # front controller
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule !\.(pdf|js|ico|gif|jpg|png|css|rar|zip|tar\.gz|map)$ index.php [L]
</IfModule>

# enable gzip compression
<IfModule mod_deflate.c>
    <IfModule mod_filter.c>
        AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/javascript application/json application/xml image/svg+xml
    </IfModule>
</IfModule>

知道我做错了什么吗?

【问题讨论】:

  • 你检查过重写的 url 是什么吗?

标签: apache .htaccess localhost nette


【解决方案1】:

解决方案: 由于服务器别名,问题出在 .htaccess 中。

我刚刚换了

# RewriteBase /

RewriteBase /documents/git/projectXY/www/

【讨论】:

    猜你喜欢
    • 2012-09-14
    • 2023-02-22
    • 1970-01-01
    • 1970-01-01
    • 2013-07-22
    • 1970-01-01
    • 2023-03-16
    • 1970-01-01
    • 2018-11-09
    相关资源
    最近更新 更多