krokvskrok
krokvskrok

Reputation: 197

.htaccess should map to index - Not working

I want to map every URL-request (which is not a file or directory) to testindex.html

My .htaccess contains this:

    RewriteEngine on
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . testindex.html

But if i try

    http://localhost/test/aaaaaaaa

then i get only a 404-Error.

Apache webserver is started and it exists a testindex.html in the test-project.

Upvotes: 1

Views: 31

Answers (2)

Justin Iurman
Justin Iurman

Reputation: 19016

Your problem is the path (because of RewriteBase).

Assuming your htaccess is in test folder, like testindex.html.
Replace your current code by this one

RewriteEngine On
RewriteBase /test/

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . testindex.html [L]

Upvotes: 1

Rwd
Rwd

Reputation: 35170

Try:

RewriteRule ^(.*)$ testindex.html [L]

Upvotes: 1

Related Questions