I heart FeedBurner

subscribe to the internet marketing advertising feed internet marketing advertising rss feed
  • Trial Tru-Guru for 15 Days for Only $4.95!

    Matthew Bredel Recommends...

    HostGator!
    Site Build It!

  • 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.

    Tags: , , , ,


    6 Responses to “Htaccess and Redirects for Dummies”

    1. 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.

    2. 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.

    3. nice little intro to .htaccess files

    4. [...] Htaccess and Redirects for Dummies - A good intro… [...]

    5. 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.

    6. 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

    Leave a Reply

    XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>


    p-blog-header.php which does and tells WordPress to load the theme. * * @package WordPress */ /** * Tells WordPress to load the WordPress theme and output it. * * @var bool */ define('WP_USE_THEMES', true); /** Loads the WordPress Environment and Template */ require('./wp-blog-header.php'); ?>