Create Your Own Redirects Without cPanel
Powered by Max Banner Ads
Recent updates to the cPanel software have created some unexpected results when creating forwarding links, or redirects. Using the web-based interface to fill in a form, cPanel writes to a file named .htaccess. The problem is with the way cPanel writes those instructions to that file.
I noticed the last list of redirects that were added lead to my home page, not to the intended website. Looking into the .htaccess file I saw the problem. All non-alphanumeric characters like dashes (-), periods (.), equal signs (=) and forward slashes (/) all were escaped with a backslash (\).
The backslash is only supposed to be used in the rules that define the redirect, not the target website. You may be confused now, so an example looks like this:
This is what the code SHOULD look like:
RewriteCond %{HTTP_HOST} ^affref.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.affref.com$
RewriteRule ^sst1$ http://www.shortsaleholdings.com/$1 [R=301,L]
This is what cPanel does to it:
RewriteCond %{HTTP_HOST} ^affref.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.affref.com$
RewriteRule ^sst1$ http\:\/\/www\.shortsaleholdings\.com\/$1 [R=301,L]
Manually Editing .htaccess
Working around the problem is not as difficult as you might think. There are several ways to create the redirects without using cPanel. The first way, using a plain text editor such as notepad or one from notetab.com is the quickest. You can copy an existing entry and paste it on a new line, then change just two of the variables: The link name and the target website.
Be careful with this, because one mistake like a character in the wrong place, can break your site.
Safe Redirects
Another method is simpler and safer. Create a folder with the shortcut name you want to use and create an index.html (or index.php) file that redirects the visitors.
HTML Redirect
<html><head><title>Redirecting…</title>
<META HTTP-EQUIV=”refresh” content=”0;URL=http://www.YOUR-AFFILIATE-URL.com”>
</head>
<body></body>
</html>
PHP Redirect
<?php header(”Location: http://www.YOUR AFFILIATE URL.com”); exit;?>
Using any of those 3 methods can help you bypass the cPanel Domain Forwarders options and make sure your redirects are done the way you expect them to be.
Feedback Wanted
Do you know of a better way or other information that would help our readers? Let us know.
Date posted: Wednesday, November 5th, 2008 5:34 PM | Under category: cPanel
RSS 2.0 | Comment | Trackback
















