How to redirect a specific IP address

24 Mar, 2010

Custom 403 forbidden error page
Question: How do I redirect every visitor to my website except for me?

Answer: There are two methods you can use to accompany the results you want and both involve using an .htaccess file. The first is to redirect your site’s visitors with standard Apache directives:

ErrorDocument 403 http://www.yourdomain.com
Order deny,allow
Deny from all
Allow from 192.168.5.5

This will redirect anyone who visits the site to yourdomain.com, with the exception of your computer or whichever computer uses the stated IP address.

Alternatively, you may use mod_rewrite to achieve similar results:

RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_HOST} !^192\.168\.5\.5
RewriteCond %{REQUEST_URI} !/temporary-offline\.html$
RewriteRule .* /temporary-offline.html [R=302,L]

Photo Source: Flickr

(0) Comment Categories : Web servers
Tag: , , , , ,

What is domain forwarding?

15 Mar, 2010

forward arrow
A number of hosts offer free domain forwarding. What is it, why do you need it, and are there any limitations?

Domain name forwarding simply lets you forward visitors from your domain to a specific URL or display a page. For instance, I could tell my host to send all visitors on domain.co.uk to anothersite.co.uk, or to display a a file like under_construction.html.

You don’t need to install any scripts if your host offers this service, but your domain will have to point to its name servers. Domain forwarding can be useful if you want to keep visitors from seeing your site while it’s under construction or have moved to a URL, but has its limitations. For instance, it is not as search engine friendly as a 301 redirect and you still have to pay the monthly hosting fee.

A number of registrars also offer low-cost or free domain forwarding.

Photo | sardinelly

(0) Comment Categories : Domain Sales, Web Hosting
Tag: , ,

How to redirect a web page without .htaccess

26 Feb, 2010

PHP logo
Question: I have a shared hosting account, but my web host has disabled my ability to make .htaccess files. How can I create redirects on my site?

Answer: First of all, it is a bad practice for a web hosting provider to completely disable .htaccess. You should probably consider getting a new host, but if that is not an immediate option, you can use PHP to redirect.

First, replace all of the code in the file you want to redirect to this:

Change the address to reflect your real domain and the correct filename for your new page.

That’s it! There is no second step. You need to make sure that there is no text before the PHP code, not even the <html> tag. Now, every time users visit the old page, they will be automatically redirected to the new one.

(0) Comment Categories : Web Hosting
Tag: , , , ,

How to use Apache to deny access to certain directories

11 Jan, 2010

403 forbidden error, access denied
In the past, we explained how to deny access to a file or directory with the allow/deny Apache server directive. There are, however, two other ways to do it that may be more to your liking. The allow/deny directive displays the 403 Forbidden page or whatever you have in its place. This might not be the most elegant way to keep users away from something. After all, it might just make them more curious about it.

Using a redirect, you can fool the site visitor into thinking the file they are looking for never existed. This will prevent any curious hackers from trying to gain access. For this example, let’s supposed you want to deny access to the “financial” directory. Edit your .htaccess file in the parent directory and add the following redirect rule:

RedirectMatch 404 /\\.svn(/|$)

Save the file, and now every time someone tries to access that directory, they will get a 404 Not Found Error rather than the 403 Forbidden one. With some simple line, you have made your private directory a little more hidden.

(1) Comment Categories : Security, Web servers
Tag: , , , ,

How to redirect Linux command output to a file

29 Dec, 2009

Linux kernel booting
All Linux servers have a useful feature that is only one character long. The character is > , and it makes saving command output to files extremely easy. It can make interpreting long command output data much easier and less time consuming.

For example, if you wanted to list the entire contents of /usr/lib, you could always run ls /usr/lib, but what you will get are pages of files and directories, probably more than your terminal window will even buffer. To solve this, all you have to do is add a > to the end of the command, followed by the location and name of a new file that will hold the information.

For example, you could save the contents to a file in /home/user and call the text file “libraries”. This assumes that the file does not already exist. If it does, > will overwrite it. Enter the following:

ls /usr/lib > /home/user/libraries

If you already have a file created with data inside and just want to append more data onto the end, add a second >

ls /usr/lib > > /home/user/libraries

Photo Source: Flickr

(0) Comment Categories : Software, Web Hosting
Tag: , , , , , ,

ICANN shakes finger at DNS redirects

25 Nov, 2009

detour
It’s become common for DNS providers to redirect users to third-party pages upon entering an incorrect URL. Called NXDOMAIN substitution, many ISPs practice this to make money. ICANN is calling out against this practice, however, citing its harmful effects:

  1. If an email is accidentally sent to an incorrect domain and redirected, a failed-delivery message might take days to arrive.
  2. Users experience greater wait times because of redirects.
  3. Hackers can exploit third party redirect sites.
  4. There are legal issues, as well. What if a user attempts to visit a certain site, but types it in wrong and is redirected to a website containing content illegal in his or her jurisdiction?

ICANN is considering banning NXDOMAIN substitution on new gTLDs. As far as I’m concerned, it shouldn’t be allowed at all.

Source | PC World
Photo | shadowspel

(0) Comment Categories : Cyber Crime, Domain Sales, Web Infrastructure
Tag: , , ,

How to Redirect HTTP to HTTPS

22 Sep, 2009

secure chase
Question: How do I force users to use the SSL version of a folder on my website?

Answer: With e-commerce websites it is very important to make sure your customers have a secure connection to your website. Nothing can be more damaging to a business than to have sensitive user information leaked to would-be attackers and cyber-criminals. While you can always make sure your links point to the SSL version of a particular page, user might still reach the page without the “https” protocol. Using a simple Apache rewrite rule, you can ensure that even if users go to http://www.yoursite.com/billing, they will be redirected to https://www.yoursite.com/billing.

In the directory you want to redirect, create an empty .htaccess file and add the following code:

RewriteEngine on
RewriteRule (.*) https://www.yoursite.com/billing/ [R=301,L]

That is all it takes. Now you will guarantee your users a secure experience whenever they access your site.

(0) Comment Categories : Security, Web Hosting, Web servers
Tag: , , , ,

2 Ways to Redirect Your Website

22 Sep, 2009

Arrow redirect
Question: I want my website redirected to another site or page on my server. How do I setup automatic redirection?

Answer: There are many easy ways to redirect your website. Here are two commonly used methods.

1. .htaccess Redirect: Using an .htaccess file, you can instruct a visitor’s browser to any page on your website to look elsewhere for that page. This is useful because, in addition to redirecting the main page of your site, you can redirect any internal page to another.

In a previous post, we learned how to make error documents using .htaccess files. This uses the same principle but relies on the 301 Redirect code rather than a typical error code. It is quick and easy. Simply create an .htaccess file in the directory of the page you want to redirect. Then enter this on the first line:

Redirect 301 /oldpage.html http://www.example.com/newpage.html
Read More >>

(0) Comment Categories : Web Hosting
Tag: , , , , ,

Comcast's typosquatting is a "service"

10 Jul, 2009

Comcast truck
Comcast has announced a new “service” in which customers who type in a domain name incorrectly are redirected to a “help page” that happens to also contain ads. It will be on by default for Comcast customers, although they are offering an opt-out setting for customers who do not want to be redirected. This new addition is called “Domain Name Helper Service” and is being tested in Arizona, Colorado, New Mexico, Oregon, Texas, Utah, and Washington.

Comcast claims to have done research on the issue and has submitted a white paper arguing that it is a “best practice” to redirect the confused masses to the appropriate guidance, which includes their paid advertisements. But already the domain world is buzzing that Comcast is the latest ISP to institute typosquatting, the practice of doing just that, redirecting mistype domains to advertisements.

When an individual capitalizes off of typos, they are ostracized and possibly even face litigation. When a major corporation does it, they are considered innovative and benevolent for offering a “service” to their customers, the hapless dolts who cannot correct their own domain name typos. Just as soon as you finish clicking Comcast ads after typing in gooooogle.com, a tiny balloon pops up to remind you that you that you have unused icons on your desktop. Welcome to the 21st century.

Photo: Flickr

(0) Comment Categories : Domain Sales, Web Services
Tag: , , , , ,

Is mass web confusion on the horizon?

25 Jun, 2009

Domain frustration
As ICANN’s expansion of the gTLD landscape grows closer, many bloggers and tech analysts are speculating mass confusion with ensue, that people will not distinguish .food from .eat domains. Some worry that the default .com for businesses will fall by the wayside and make it difficult for users to find the sites they want.

Forget that the practice of inexperienced web users typing “.com” for anything they want instead of using a search engine is sheer ignorance that should be corrected rather than coddled. Forget even that if a company really wants people to go to McDonalds.fastfood instead of McDonalds.com, they will undoubtedly pour millions of dollars into advertising it until people are typing it in their dreams at night. Instead, we should just focus on the reality. The days of .com supremacy are far from over. There is no need to even worry about that.

What the change means for businesses is more about focusing specialties, than general corporate sites. Wyatt’s Widgets will probably still have wyattswidgets.com, but now that main site can provide a central portal to their subsidiaries: sprockets.wyatts, cogs.wyatts and anything else they can imagine. Web site owners are certainly not interested in trying to confuse users. Look for more portals, redirections and large ad campaigns rather than people haplessly tapping in cheapfood.com when they really wanted cheap.food.

Photo: SXC

(0) Comment Categories : Domain Sales, Web Infrastructure
Tag: , , , , , ,