Skip to main content

Problems blocking MySpace using HOSTS file

A visitor ("Bethany") posted a question:

I did as your instructions said and I'm still able to access myspace. I've pasted my host file below. What else can i do? I really need myspace blocked.

# Copyright (c) 1993-1999 Microsoft Corp.
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
# For example:
# # source server
# # x client host localhost myspace

Any takers? on my systems, the single entry for blocks everything.

Reboot needed? HOSTS file in the wrong location?

Can't block

Surely someone has to have some idea why I can't block myspace :(....I've done a reboot and pretty sure that the hosts file is in the right place. I found it using directions given previously. Does anyone know of some software I can buy that would really work and not just claim to work? Thanks to anyone who can help me out here...It's much appreciated ;)

When you use too many names,

When you use too many names, as is your case; your host file might have problems loading all of them, so my advice would be to use wildcards, such as (*) at the beginning and end of the website's name you are trying to block. ex: ** or simply *myspace* try replacing all your previous names with just this two, and let me know if it works.

You can't have wildcards in

You can't have wildcards in the HOSTS file, just fyi ;)

Block myspace with DNS

You can go to your dns server and create a forward lookup zone called Within the zone create a alias and for www and redirect it to or whatever you like. You will have to create alias for, This should block everything...flush the dns on the servers and workstation and type in and it should redirect it to I have done this at my work place and for YouTube great without buying any expensive software.


localhost should be first entry

I think your problem is here: localhost

The localhost should always be the first entry above all others. Try this. Close all of you browsers, edit your host file like the example below so that localhost is first. Save the host file and try to get to myspace. localhost

If its a vista machine you

If its a vista machine you have to disable the UAC in the control panel, reboot, then change the host file.


I follow your instructions and it blocks myspace. But when I reboot the hosts entries are gone and I can access myspace. Is there something erasing the hosts file? I think it might be my anti-virus software?

My guess..

well, if you were able to block myspace, I don't understand why would you want to access it again?
Anyways, the wildcards won't erase information in your files, they'll just avoid them to be loaded.

Sorry, my bad...

I misundertood when reading your post.
Ok, first you need to make sure you're making the changes as an Administrator, and then you set the file as "read only" in properties. That should make it!
Remember to save a copy of the original; just in case.

Thank you: "Block myspace with DNS"

I did this and it worked great. I redirected it to my company's website! just the basic entry was enough. it also took care of the login and profile pages too.

Don't forget DNS

This also may help.

After altering your hosts file and saving it, don't forget to close your broswer. Then, at a CMD prompt, enter these 2 commands:

ipconfig /flushdns
ipconfig /registerdns

Restart your browser and try again.