Jump to content

[SOLVED] Not working when the file doesn't exist locally


superjoe30

Recommended Posts

I'm trying to use mod rewrite with apache. I'm just using this simple code to test it for now:

RewriteRule .* test.htm

 

Should be simple - no matter what is requested, pretend it was in fact test.htm that was requested.

 

The problem is it works only if the requested url exists on the server. For example if my root directory contains:

blah.txt
blah2.txt
test.htm

 

and I navigate to http://localhost/stinkycheesebombs

 

It prints 404, when really it should send test.htm to the browser.

 

If I navigate to http://localhost/blah.txt, it does exactly what it's supposed to. It only malfunctions if the file doesn't exist. But the file doesn't have to exist, and in fact it should not exist for what I'm trying to do.

 

Any ideas?

 

 

I already have RewriteEngine on, I'm not retarded.

 

I forgot to use ^ and $ when I posted on this forum, but not in my .htaccess.

 

The point here, is that simple URL rewrites DO NOT WORK if the requested file does not exist on the server, and the URL rewrites YES DO WORK if the requested file exists on the server. Why would this be?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.