|
Part 2 - .htaccess Commands
Introduction Stop A Directory Index From Being Shown Sometimes, for one reason or another, you will have no index file in your directory. This will, of course, mean that if someone types the directory name into their browser, a full listing of all the files in that directory will be shown. This could be a security risk for your site. To prevent against this (without creating lots of new ‘index’ files, you can enter a command into your .htaccess file to stop the directory list from being shown: In some situations, you may want to only allow people with specific IP addresses to access your site (for example, only allowing people using a particular ISP to get into a certian directory) or you may want to ban certian IP addresses (for example, keeping disruptive memembers out of your message boards). Of course, this will only work if you know the IP addresses you want to ban and, as most people on the internet now have a dynamic IP address, so this is not always the best way to limit usage. You can block an IP address by using: You can allow an IP address by using: If you want to deny everyone from accessing a directory, you can use: Alternative Index Files You may not always want to use index.htm or index.html as your index file for a directory, for example if you are using PHP files in your site, you may want index.php to be the index file for a directory. You are not limited to ‘index’ files though. Using .htaccess you can set foofoo.blah to be your index file if you want to! Alternate index files are entered in a list. The server will work from left to right, checking to see if each file exists, if none of them exisit it will display a directory listing (unless, of course, you have turned this off). DirectoryIndex index.php index.php3 messagebrd.pl index.html index.htm Redirection One of the most useful functions of the .htaccess file is to redirect requests to different files, either on the same server, or on a completely different web site. It can be extremely useful if you change the name of one of your files but allow users to still find it. Another use (which I find very useful) is to redirect to a longer URL, for example in my newsletters I can use a very short URL for my affiliate links. The following can be done to redirect a specific file:
More >>>>>> Www.EbnEzz.NET
Comments |
Recent Posts
No Title
Library Films EbnEzz.net Part 3 - Password Protection Part 2 - .htaccess Commands Part 1 - Introduction Displaying Data EbnEzz Submit Tutorials Syndication Tools |
|
You are not logged in. FREE Sign Up or Log In
©2008 Flixya Entertainment, LLC. All rights reserved.




Free Sign Up - Start Making Money on Flixya »



