Apache redirect treating a file like a directory

0

I have three files, an index that's a wrapper for the other two, file1 and file2. It uses a PHP server variable to determine which to include.

By default, the wrapper includes file1. So, /, /index and /file1 all lead to the expected result: it shows the contents of file1 surrounded by the header and footer provided in index.

When I go to /file2, the browser goes to /file2/. It displays the proper text, but the stylesheets and scripts can't be loaded because it's looking in /file2/, which doesn't exist.

I've tried renaming the .htaccess file but there's no change. Its contents are:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule . /index.php [L]
</IfModule>

The relevant portions of the virtual host's config file is:

<VirtualHost *:80>
    ServerName example.com

    DocumentRoot /path/to/htdocs

    Include /etc/apache2/conf.d/*.conf

    <Directory "/path/to/htdocs">
        Options -Indexes
        AllowOverride All
    </Directory>
</VirtualHost>

Any help would be much appreciated.

Thank you!

KJ G Coop

Posted 2019-08-23T21:49:19.230

Reputation: 1

No answers