One of the most powerful, yet simple manipulations that can be done with your htaccess file is a basic redirect function.
One of the most powerful, yet simple manipulations that can be done with your htaccess file is a basic redirect function. A .htaccess file resides in the web-root directory of most Linux servers that have Apache installed (which is a majority of the servers online). This .htaccess file is a text file which contains user-defined server configuration settings, which include URL manipulations.
The simplest and most common configuration setting is the redirect. Using this function, you can create pseudo directories and files on your local host that will redirect to other URLs. This can be used to hide (or cloak) affiliate links and manage the file linking structure of your website more efficiently. The syntax is simple:
redirect {local/pseudo location} {destination URL}
Example:
redirect /facebook http://www.facebook.com/pa…
If this htaccess file resides on my blog at http://www.matthewbredel.com and I typed in:
http://www.matthewbredel.com/facebook
My host will redirect the user to:
http://www.facebook.com/pages/Ryan-Moran-and-Matthew-Bredel/…
Try it!
Go to: http://www.matthewbredel.com/facebook
I think you would agree that the local URL is much cleaner and easier to remember than the destination URL.
|
Don't Buy Another Money Making Product Until You Watch These FREE Videos! |
My name is Matthew Bredel and as of March, 2007, I am a full-time, work-at-home internet marketer.
For close to 10 years, I worked for a defense company which was an OK job, but I was so uninspired in life and frankly, I needed some more money. That is when I first discovered internet marketing! Now I admit that I didn't start making thousands in my first couple of months (in fact, I lost my shirt!), but I finally saw the "internet light"...


I just had a “duh!” moment. Been trying to figure out a way to do some redirecting, and I hadn’t even though to do an .htcaccess file. Duh… I suppose that’s why you’re the mastermind.
April 7th, 2008 at 9:37 pm
I spent awhile trying to find a solution to this problem (including cheesy cloaking programs, etc.), but they did not work well and these redirects are SO easy. It was a true lightbulb moment when I stumbled about these htaccess files.
April 8th, 2008 at 6:31 am
nice little intro to .htaccess files
April 9th, 2008 at 7:31 am
[...] Htaccess and Redirects for Dummies - A good intro… [...]
April 12th, 2008 at 5:42 am
Matt,
Oh my gosh this looks very easy.I wish I’d seen this post last year when you wrote it!
I say ‘oh my gosh’ because I broke 12 of my websites when I tried to do something like this a few months ago. The nice people at hostgator fixed it for me which was nice of them but didn’t teach me what I did wrong.
So…next week I’m going to see if I can do another one myself. Let’s hope I don’t break anything. LOL.
February 10th, 2009 at 7:58 pm
Hey Dana,
You know you’ll always have me as tech support! But remember that fiddling around with htaccess files can be scary, as you have learned.
Still, it is perhaps one of the most overlooked, under-used, super powerful (and most cryptic!) components of managing a website’s linking structure!
cheers…matt
February 11th, 2009 at 8:24 pm