I am trying to block/redirect the adult sites to loopback using etc/hosts file in my computer.
like,
127.0.0.1 www.someadultsite1.com
127.0.0.1 someadultsite1.com
But the sites keeps changing the number which is at the end of domain name, for eg. www.someadultsite1.com gets changed to www.someadultsite2.com after few days making it harder to keep chaning the etc/hosts file every now and then.
Is ther a way to block all the same sites ending with anynumber
like www.someadultsite*.com or something?
Related
I'm experimenting some PHP code with a local IP address http://192.168.33.10.
When I was using the address in a form of number (192.168.33.10) it was working fine (see image 1), but when I try to use a domain name "dev.dotinstall.com", it reaches an error page (see image 2).
I learned that you can use a name like "dev.dotinstall.com" instead of IP address by editing hosts file, so I edited it adding a line "192.168.33.10 dev.dotinstall.com" at the end of the hosts file (see image 3).
The error page says "The fact that you are seeing this page indicates that the website you just visited is either experiencing problems or is undergoing routine maintenance.", but I don't know what the problem is.
Any idea why this is happening?
You are correct that you need to add the URL into the hosts file. Make sure you have saved it correctly (with administrator rights) and the port is correct.
This is not enough though, you will need to set up a virtual host for Apache as well and then restart Apache. If you only set the URL in the hosts file, then Apache will not know what to do with it. There are plenty of materials on setting up a virtual host for Apache on Windows if you search for that.
I am having the following /etc/hosts file :
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
192.168.10.139/azc clientdomain.com www.clientdomain.com
80.230.215.84 home_server
The first, second and fourth line are working normally. However the third isn't. I tried to look for "invisible characters" and rewrote the whole line without copy-pasting anything, but the clientdomain.com query in my browser or via ping still brings me to my client's IP address.
Am I not allowed to use paths at all in my hosts file, just sheer IP addresses?
If I take out the /azc bit, the redirection does happens correctly.
I don't manage to have it working through .htaccess redirections either...
I was actually trying to redirect a domain name to a specific folder on my server.
I finally discovered (Doh!!) that Apache has a dedicated feature for this called VirtualHost.
This post explains very well how to set one.
I hope this helps.
I have a server with Plesk and CentOS.
http://cdn.oyunlar1.com/images/8836.jpg file is located in server A.
http://www.oyunlar1.com/modaokulu.html file is located in server B.
I basically want the same thing except I want to locate media files in a different domain instead of different server. Like this:
user visits cdn.mydomain.com/file.swf
but they actually read files from mydomain2.com/file.swf
I tried changing IP of A record of the subdomain to mydomain2.com's IP but it didn't work.
How can I do it?
Edit: I want to do this because it will help me to change my hosting provider very quickly and easily becuse media files are +100GB and the rest is like 10MB.
Solution was simply adding CNAME record to mydomain.com of mydomain2.com and using htaccess at mydomain2.
(You can skip directly to the question, but the context is on the background section.)
Technical Context
Windows 8
IIS 7
Background:
As several others, I work with IIS and from time to time I need to set up a local version of a site. Now, in setting up different sites, it is quite common to just assign them different ports so that they don't overlap. So you could have your site A at port 80, your site B at port 81 and so on.
Now, I want to setup the bindings so that I am able to have several sites under port 80 and with the header host distinction I can at the same time give meaningful URLs to these sites.
An option to do this is with adding entries to your hosts file, such as:
127.0.0.1 siteA.com
127.0.0.1 siteB.com
And with this, you should be able to browse to siteA.com or siteB.com and have that working locally.
But I want to take one more step, as localhost is already set up to match 127.0.0.1, so:
Question:
I had set up the IIS bindings as:
site host header port
siteA siteA.localhost 80
siteB siteB.localhost 80
And I expected that I would be able to browse to http://siteA.localhost/ and http://siteB.localhost/ and get my sites.
However, when I browse, it seems that my requests never reach IIS, and the address is not resolved.
Why isn't that working?
Update:
I have chosen chue x's answer because he explained why this doesn't work. For those that may follow my same path, you may think "well, I could just add *.localhost in the hosts file and it should be done." or even switch to *.local or *.localdev.com or something of that sort.
That, however, doesn't work: Wildcards in a Windows hosts file
As chue x pointed out, our only approach right now is to keep adding entries to the hosts file or, how they explain in the linked question, to use another DNS server.
Your hosts file needs to match your IIS bindings, which have to match the url browser.
So if your hosts file looks like:
127.0.0.1 siteA.localhost
127.0.0.1 siteB.localhost
Your IIS bindings need to be:
site host header port
siteA siteA.localhost 80
siteB siteB.localhost 80
Finally, from the local machine, you need to browse to:
http://siteA.localhost
EDIT - If you are trying to do the above without adding the hosts entries for siteA and siteB, it won't work. DNS won't find it. So for example, what happens if you try to browse to "foo.stackoverflow.com" - the request will fail even though "stackoverflow.com" is a known address.
How can you test CloudFlare without changing your domain's name server?
I would not want to change my domain's name server and wait hours for propagation only to find out there is a issue with the DNS settings.
Can you spoof a nameserver or something on a local hosts file?
Yes, you should be able to test before you change your name servers. Here's what to do:
Signup at https://www.cloudflare.com/sign-up and complete the signup through Step 4 when you're asked to update your name servers.
Note the two name servers you are provided which will be in the format [name].ns.cloudflare.com.
From a terminal, do a lookup to get the IP addresses your domain has been assigned. In Linux/Unix it'd be: dig #[name].ns.cloudflare.com yourdomain.example
Repeat step 3 with all the subdomains you want to check.
Update your localhost record to resolve the domain(s) to the IPs you found with the lookup.
Browse the site from the same machine where you did the localhost update and traffic should pass through CloudFlare.
While this will work for a while, after 24 hours CloudFlare's system may detect that your name servers haven't updated and, in some cases, may return an error. However, this technique should allow you basic testing before you update your name servers.
To save future users from some headache, the above answer doesn't work anymore: https://community.cloudflare.com/t/ip-on-cloudflare-nameserver-is-not-masked-despite-orange-cloud/76137
From my understanding, you now need to change your nameserver.