Mobile app version of vmapp.org
Login or Join
Jessie594

: Send 404 Status Code on www.example.com Does anyone know if it's at all possible (preferably with .htaccess), to send a 404 error code and page when visiting http://www.example.com but have http://example.com

@Jessie594

Posted in: #Htaccess #Redirects

Does anyone know if it's at all possible (preferably with .htaccess), to send a 404 error code and page when visiting www.example.com but have example.com working just fine?

I want to 404 the entire www website including the homepage.

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Jessie594

2 Comments

Sorted by latest first Latest Oldest Best

 

@Tiffany637

It makes no sense to run a HTTP server on a (v)-host if every request will result in a 404. Why not just fix your DNS setup so that the www subdomain isn't matched by any records? That way, the www variant won't even resolve.

10% popularity Vote Up Vote Down


 

@Murray155

Something like this should do the trick:


RewriteCond %{HTTP_HOST} ^www.domain.com [nocase]
RedirectMatch 404 ^(.*)

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme