Wednesday, January 22, 2014

htaccess For Beginners and Non

htaccess For Beginners and Non

If you anything like me, code is a scary thing. I not a tech type person, and it not because I can do it. I just don have the time and opportunity at the same time to learn it as thoroughly as many others.

That doesn mean I smart enough to leave it alone, however. Nope. Not me. I dig right in, and if I screw it up which happens more often than not, I fix it and eventually figure out what I doing. Along the way, I managed to learn a bunch of interesting tidbits that will make this tech stuff easier for anyone else just starting out.

Yes, this is a beginner post, but I think fear is the biggest reason why so many people avoid it. They different from country to country, and simply don allow people to just do what they want. With the right code, you can do neat things like redirect from one address to another, ensure that the www portion of a URL is used instead of the nonwww address, and even prevent people from accessing the information on your server.

It found in the root of your server and looks really scary once you get it opened up, but notepad or text editor makes it much more manageable. There a few things you need to know before you start monkeying with things, however:

It ok to screw things up and play with things you know nothing about, but be smart about it. Don use them unless you bored and can find any other solutions ie the plugin conflicts with something else, there is no other way around it for your CMS

This stuff works only in Apache Web Server on Linux/Unix and Window OS. Use them with the wrong software, and you figure it out pretty quickly. Code looks strange, but the code you add will look REALLY strange and cause all sorts of bad things to happen.

Contrary to what many of us nontechs believe when we get started, code isn exactly copy and paste. And so on let you figure out the rest. We make it a game. It be fun!

Once you get good at playing with this stuff, you can tweak the code to cloak pages and do all sorts of cool stuff.

Don be afraid to try different things.

When you done playing with it, show it to someone you can trust who knows what they doing. If that you, try code like this below:Redirect All Except Specific IPs

Cloaking and other techniques usually work via IPs. If you want to serve up different pages for different people ex. People in your company see a different page than people outside your company., try:If you like to allow everyone except certain people, switch deny and allow. This works great for creating a list when you getting a large number of spam hits from a specific IP range. Oh, and speaking from experience: DON put your own IP in that list! Don ask on a Screw Up, You Missed a Redirect, Or Someone Did Something They Weren Supposed To

We all try really hard not to make mistakes, but it happens. If we going to make a mistake, however, we may as well do it with style. Customer error pages, that is. Here how to serve up:

And yes, you need to make the page and name it the right thing, or change the filename in the code.

When All Else Fails I want to do something and just can seem find it hidden in this creative brain of mine, I use someone else That right ask someone, or I go digging. Here some links to some great code samples I sure you use at one point or another:

No comments:

Post a Comment