Search code examples
apache.htaccesslocalhostnette

nette, localhost, 404 on subfolders


I'm running nette framework at localhost using XAMPP. When I go to index page everything is fine but when I click to URL for some sub page I get 404 error.

I set in apache (httpd-vhosts.conf) alias to my documents folder:

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>

When I go to index page using URL http://localhost/documents/git/projectXY/www/ everything is ok

But when I click on Sing in button with URL http://localhost/documents/git/projectXY/www/customer/sign/in I get 404 error

in www folder I have 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>

Any idea what am I doing wrong?


Solution

  • SOLUTION: Problem was in .htaccess because of server alias.

    I've just changed

    # RewriteBase /
    

    to

    RewriteBase /documents/git/projectXY/www/