ah-blabla
New Member
- Messages
- 375
- Reaction score
- 7
- Points
- 0
If you are currently working on a site, say at a subdomain sub.example.com, and would like to have all traffic going there redirected to example.com/page.html, but you still want to be able to access sub.example.com, you can use these htaccess commands:
This is useful e.g. when you are constructing a site and have already started advertising the address, but don't want it visible to anyone except yourself.
Note: this is a made up IP in the code. Also, dydns domains don't work, since Apache uses reverse lookup to find the domain, so your PTR records must be correct if you're using a domain.
Code:
# Where you want to redirect to
ErrorDocument 403 http://example.com/page.html
order deny,allow
# You want everyone blocked
deny from all
# Except for your IP (replace with your IP)
allow from 60.118.156.100
This is useful e.g. when you are constructing a site and have already started advertising the address, but don't want it visible to anyone except yourself.
Note: this is a made up IP in the code. Also, dydns domains don't work, since Apache uses reverse lookup to find the domain, so your PTR records must be correct if you're using a domain.
Last edited: