LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 12-02-2011, 05:28 AM   #1
qwertyjjj
Senior Member
 
Registered: Jul 2009
Location: UK
Distribution: Cent OS5 with Plesk
Posts: 1,013

Rep: Reputation: 30
use htaccess higher up directory no symlinks?


I have 3 folders for 3 different websites all with an admin folder that I currently block off IP addresses with via an htaccess file:

<Limit GET POST PUT>
order deny,allow
deny from all
allow from 109.150.55.xxx
</Limit>

linuxfolder/mysite.net/admin/.htaccess
linuxfolder/mysite.com/admin/.htaccess
linuxfolder/mysite.eu/admin/.htaccess

Each site runs different code and different databases so I cannot combine them.

How can I combine each of these htaccess files into 1 htacess file at the higher level domain linuxfolder so I don;t have to keep adding IP addresses into 3 individual files?

I do not have root access to the server so cannot use symlinks.
 
Old 12-02-2011, 04:46 PM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,073

Rep: Reputation: 1971Reputation: 1971Reputation: 1971Reputation: 1971Reputation: 1971Reputation: 1971Reputation: 1971Reputation: 1971Reputation: 1971Reputation: 1971Reputation: 1971
Hi,

I guess /path/to/linuxfolder is your docroot. If that's the case, you can use mod_rewrite in a .htaccess file in docroot, like this:
Code:
RewriteEngine on

RewriteCond %{REQUEST_URI} ^/admin
RewriteCond %{REMOTE_HOST} !^109.150.55
RewriteRule (.*) - [F]
If you want to allow saccess to pecific hosts and not to the whole subnet, you can replace the 2nd RewriteCond with this
Code:
RewriteCond %{REMOTE_HOST} !^109.150.55.1
RewriteCond %{REMOTE_HOST} !^109.150.55.2
and so on

Regards
 
Old 08-20-2012, 09:10 AM   #3
KernelJay
LQ Newbie
 
Registered: Aug 2012
Posts: 15

Rep: Reputation: Disabled
Exclamation Be careful with that Limit Tag

qwertyjjj - I realize this response is a couple months late, but please note that there is some potential for this style of htaccess configuration to be bypassed. As outlined in the linked blog post, Apache may still hand off a request from those IPs if they use an HTTP method other than what you have specified in the Limit tag.

Read about it here: http://blog.ncircle.com/t5/VERT-Secu...-Tag/ba-p/4942
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Using .htaccess instead of symlinks PlymWS Linux - Server 1 04-06-2010 12:43 PM
I am having a problem with my symlinks in the /dev directory JasonC10203 Linux - Newbie 2 08-13-2008 08:49 AM
script/command to delete all symlinks from a directory reddazz Linux - General 5 03-15-2005 11:39 PM
Directory with .htaccess is invisible?! Barca Linux - General 5 02-23-2005 12:28 PM
symlinks in / directory Bruce Hill Linux - Software 4 10-24-2004 08:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 09:43 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration