Francis
Francis

Reputation: 147

Conditions in .htaccess file

I have two domain names examplesite.com and examplesite.net but they point to the same hosting server i.e. website.

Now I have written an .htaccess file because I wanted to show custom 404.html file. Here is the code in my .hraccess file.

ErrorDocument 404 http://www.examplesite.com/404.html

When a user gets a 404 error when he is on examplesite.com he is redirected to the above address which is ok. But when a user gets 404 error when he is on examplesite.net he is redirected to the above address i.e. 'examplesite.com/404.html' .I wanted the user to stay on examplesite.net/404.html. I do not want the url for the redirection. Is there a solution for this? Please help. Can I apply condition or something like that?

Upvotes: 0

Views: 48

Answers (1)

Zoli Szabó
Zoli Szabó

Reputation: 4534

You can simply use

ErrorDocument 404 /404.html

The domain prefix is not needed.

Upvotes: 2

Related Questions