Jump to content

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


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?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.