Linux Blog

htaccess allow from

Filed under: General Linux — TheLinuxBlog.com at 10:32 am on Tuesday, September 9, 2008

htaccess allow from gives you the ability to allow (or deny) specific IP’s or domain names from a directory on your server. To do this the syntax is quite simple. Using VIM or nano open up the .htaccess file in the directory that you want to restrict access to. You need to add the following:

Order Deny,Allow
Deny from all
Allow from 127.0.0.1

This allows access from your local host and the IP address you specify. Using .htaccess you can also allow by host name. This is useful if you wish to allow or deny a friend access to a directory. (note: it will also work if you have them in your hosts file)

Order Deny,Allow
Deny from all
Allow from LinuxBlog
Allow from .thelinuxblog.com

Using htaccess to allow from your LAN is also pretty easy. You use your CIDR address (ip/subnet) to do this try something like this (changing to match your LAN):

Order Deny,Allow
Deny from all
Allow from 192.168.1.1/24

I run into htaccess allow problems a lot, and hope that this will clear the air up for me. htaccess can be very handy if you do not want to keep turning your firewall on and off, but do not want your directories wide open. Just remember, if you want to stop everyone except those you choose to access your apache web directories, use htaccess allow from!

Recent changes to The Linux Blog.

Filed under: The Linux Blog News — TheLinuxBlog.com at 10:39 pm on Sunday, July 29, 2007

This article is mostly just updates on the site.

Server Changes
I have recently moved the site to a new server. This was a fairly simple task which took longer than it should because of DNS issues.

Now that it is on the new Linux based web host all should be dandy. The fact that I have more flexibility over the old host is an added bonus.

Bugs

Some problems that surfaced after I moved the site have just been resolved in a matter of minutes ago.

The biggest problem the site had was that the detailed/archive WordPress URL’s were not getting processed correctly. I was aware of the problem last night but was too tired to fix it. The fix was simple. I had to place the .htaccess file in the directory. The problem was that when I used lftp to mirror the old code, it didn’t download the hidden .htaccess file. I should have checked this before I updated the DNS but I guess something will always go wrong and I’m glad it was a simple fix. When I figure out how to mirror a directory in lftp including hidden files I will be sure to let everyone know. After scanning the help for the mirror command it didn’t jump out at me, but maybe thats just because I’m tired.
The URL’s that were affected by the bug were:

http://www.thelinuxblog.com/2007/07/29/shell-script-sundays/

http://www.thelinuxblog.com/2007/07/28/phones-meet-linux/

New Category Created
Not only did I fix this little problem, I also created the Shell Script Sundays section and moved the related posts to that category. The When Photoshop Fails article was posted on a Monday but I did most of the writing on Sunday, so I believe that since its mostly a shell scripting article it is worthy of this category.

After writing a paragraph in the description section of WordPress, I realized that it doesn’t actually show up anywhere on the site. I’m unsure if it shows up in the RSS feeds or not but I’m going to post it here anyway for the web browsers.

Shell Script Sundays Description
This section of the site is dedicated to Linux shell scripts. Twice a month I will post a nifty shell script that will perform a certain task. Most of the scripts will be written in Bash or the Korn shell and occasionally a CLI PHP or Perl script may surface. Some scripts will be more advanced than others and some will require additional software to be installed. This section will show how powerful scripting can be and I hope it educates people on how to shell script with Linux.

More to come!

Expect a Linux related post within the next few days. I have hundreds of topics to choose from, but I am always willing to take peoples suggestions on what to blog about. So if there is a particular topic that interests you, just contact us and we’ll do our best to cater to your needs.

Ciao,

- Owen.