htaccess - IP address contains ':' instead of '.' - .htaccess

A client uses the website 'whatsmyip' website to determine their IP address. What they return is something like 2001:8003:52ed:4700:d9f:ac11:4f79:xxxx
Do the same rules apply in creating blocks in the htaccess file?
For example, can I add:
allow from 2001:8003 to permit access to all IP's starting with 2001:8003?

Related

Block anything using an IP instead of a domain

Getting a lot of traffic [likely bots] that are hitting my site via an IP address instead of a domain.
For example, a user would access my site at https://www.example.com/login but I'm getting traffic using the IP instead: https://123.45.678.910/login
I would like to block access to anything using the IP instead of the domain. Can this be done via the .htaccess file?
I can do it via PHP, but by then, it's already wasting resources. Is there another / common / best-practice way to handle this?
When googling for the solution, I get a LOT of information about how to block or allow specific IP address(es) or range of IPs, but that's not what I'm looking for.

Creating a sub-subdomain on AWS Route 53

I'm trying to set up a a domain for our staging environment which mirrors the domain structure of our production environment. For example:
puppet.example.com # production
puppet.staging.example.com # staging
I have a hosted zone for example.com where I have the puppet subdomain working fine. I've also created a hosted zone for staging.example.com and created a record for the puppet subdomain within that, but I can't get it working.
When I use nslookup on puppet.staging.example.com the IP address that appears isn't the address I've configured on Route 53.
Do I need to do something different when setting up a hosted zone for a sub domain?
To host both puppet.example.com and puppet.staging.example.com using AWS Route53, you would only need to create one hosted zone:
example.com
Once you create the hosted-zone, you would create two "record sets", one for each sub-domain. Since you want the names to be equivalent, their type and value should match (i.e., the A record or CNAME record should be the same).
You don't need to do anything special about "sub-subdomains," just include a dot (.) in the name. For example:
Name Type Value
puppet A 1.2.3.4
puppet.staging A 1.2.3.4
To support both example.com and subdomains with .(dot) included, you need to use wildcard for the hosted zone name as follows.
*.example.com
For more information read the documentation on domain name format. Also note that, when mapping the subdomain with wildcard following rules needs to be met.
The * must replace the leftmost label in a domain name, for example,
*.example.com. It can't replace any of the middle labels, for example, marketing.*.example.com.
The * must replace the entire label. For example, you can't specify
*prod.example.com or prod*.example.com.

DNS Redirect Clarification

We have old domain name which we would like to redirect the traffic to new domain
e.g.
old.domain.com --> new.domain.com
Help/Clarification:
What's the best way to achieve this? Read about CName, ARecord, Alias etc., therefore confused which one to use and which scenario.
If we redirect old.domain.com to new.domain.com, then what will IIS/Web Server see as requested host name i.e. still sees old.domain.com or new.domain.com
If you want to redirect the traffic, i.e., you want the customer's web browser to show the change from "old.domain.com" to "new.domain.com", then you'll need to insert that redirect at the web server or code level.
If you simply want a request for "old.domain.com" to land on the address for "new.domain.com", then you can use just a CNAME in DNS.

htaccess global ip address, ipv4, default gateway confusion

forgive the trivial question but I don't understand how to use ip addresses properly to deny access to my site. Let's say i have got the web site www.mywebsite.com. Suppose I have the following 3 ip addresses from my office machine:
ipv4: 192.1.2.3
default gateway: 192.1.2.345
and the global ip for my network: 456.34.56.78 (retrieved using www.globalip.com)
Now I would like to grant access to any user in my network hence i would have thought that the right number to use is the global ip 456.34.56.78 common to all machine in my office:
I am using the following code:
# redirect all visitors to alternate site but retain full access for you
ErrorDocument 403 http://www.bbc.com
Order deny,allow
Deny from all
Allow from 456.34.56.78
but it is not working. It is redirecting all machine in my network as well as external ones.
What I am doing wrong? Thank you for your help

Make original site url name to some fake url name

I am new to rewrite site url name. I have a site url like http://66.15.101.250/test/ . this is my owned server link So i want to change this site url to something other name like http://testsite/test/ ( i do not want to give domain name to this ip address url).And i have otheres site running on this http://66.15.101.250/test/ server . I have no idea how to do this, what should i do.
Is this possible through .htaccess file or something else
Thanks in advance
Your server can only respond to requests it receives, and will only receive requests routed to it by DNS, so if you don't own the domain name, you can't receive public traffic directed towards it. You could silently redirect users from
http://66.15.101.250/test/ to the content found at http://testsite/test/ but they would still see the http://66.15.101.250/test/ url in their browser.
If you think about it, its a good thing you can't do this or I could make stealyourcreditcardinfo.com appear as paypal.com. Indeed most uses for what you are asking about would not be legitimate ones...
For your own internal testing purposes, you can make virtual host entry for testsite.com and your server will respond to any requests it receives for testsite.com. You then change your HOSTS file to point testsite.com to 127.0.0.1 and testsite.com will work in your browser, but only on your machine because you manually overrode your own DNS. The DNS everyone else is using is still pointing testsite.com to the actual IP address somewhere else
If you need this for testing purposes (as it seems to me), you can put 66.15.101.250 testsite in your hosts file and configure a virtual host for testsite in your webserver.

Resources