www. stripped off URL - ErrorDocument 404 redirect .htaccess

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
RichardCreek
Forum Newbie
Posts: 2
Joined: Fri Mar 19, 2004 5:17 pm

www. stripped off URL - ErrorDocument 404 redirect .htaccess

Post by RichardCreek »

Hi everyone, I've used a .htaccess file like the following on various sites with no problems:
ErrorDocument 404 /example.php
DirectoryIndex /example.php
this way i can create a psuedo URL e.g. http://www.domain.com/cat/subcat (where cat and subcat aren't real directories) in my other scripts, and it gets redirected to example.php which can then examine $REQUEST_URI to extract cat and subcat and setup the page accordingly. This method has worked fine on most servers.
The problem i've had with a couple of servers is the www. part of the URL is disappearing after the redirect. If anyone know's what might be causing this and how to prevent it happening, please let me know.

cheers,
Rich. :?:
Post Reply