htdocs varied portals access level

Problems with the Windows version of XAMPP, questions, comments, and anything related.

htdocs varied portals access level

Postby aspardeshi » 02. December 2011 04:33

Hello Room,

I have Xampp latest version loaded on Windows XP SP3 I have xampp on j: now I have varied portals (folders) in htdocs folders all the applications are running fine. The server is natted with public IP and is available to public. The indexes are off (OK) I have redirected the public to the required public portal.

Now the problem starts here. I do not want to give access to all other folders to public except one. I have set a redirect to the required public folder if the public IP is browsed over internet and indexes are put off. I have provided local network people access to the other folders. they are actually required to access those other folders from my local LAN only. Some people from my local network (they know my other folders) has a chance to browse from internet (not from local network) if they physically type the public ip with the folder name over internet. So I want to prevent access to other folders for traffic from my public IP but keep only one folder access. to make it more clear please see the example below:-

htdocs/folder1 access from public ip only
htdocs/folder2 access from local network only
htdocs/folder3 access from local network only

I am expert only in application development because I do all my work with the help of php framework. I am weak and noob in Apache, PHP. How is that possible in Xampp. I do not know where to do and how to do. I was able to find htdocs.conf file and found varied access levels to all my folders. Can I change there something ? like allow from IP range or deny from for IP range for all my visible folders in htdocs.conf ? or shall i work with .htaccess

Please help me.
aspardeshi
 
Posts: 5
Joined: 02. December 2011 04:22
Operating System: Windows XP, Windows 7, Mac OSX

Re: htdocs varied portals access level

Postby Sharley » 02. December 2011 05:47

You can use a .htaccess file in each folder that you need to control by using the Order Deny Allow directives.

The .htaccess file acts like an individual server configuration file for each folder or folder tree it is placed in.

Best if you do an Internet search for .htaccess as there are many good examples and tutorial sites available that will help you get started.

Good luck. :)
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: htdocs varied portals access level

Postby aspardeshi » 02. December 2011 06:02

Thanks Sharley,

I will see to it and come back here with a solution. Have a great Day ahead ! :)
aspardeshi
 
Posts: 5
Joined: 02. December 2011 04:22
Operating System: Windows XP, Windows 7, Mac OSX

Re: htdocs varied portals access level

Postby aspardeshi » 02. December 2011 13:48

Hi Sharley,

My os is windows xp. I doubt if .htaccess will work with it. I have visited several websites and have come to know this. I have kept both files .htaccess and htaccess.txt in the folder but no luck.

Can you please suggest what I am doing wrong ?

Please help.
aspardeshi
 
Posts: 5
Joined: 02. December 2011 04:22
Operating System: Windows XP, Windows 7, Mac OSX

Re: htdocs varied portals access level

Postby aspardeshi » 02. December 2011 13:50

here goes the code I have given in .htaccess and htaccess.txt (ip number is replaced with xx for security reasons) and these 2 files lie inside the folder for which I want to prevent access to the public IP.

<Limit GET HEAD POST>
order allow,deny
deny from xxx.xxx.xx.xxx
allow from all
</LIMIT>
aspardeshi
 
Posts: 5
Joined: 02. December 2011 04:22
Operating System: Windows XP, Windows 7, Mac OSX

Re: htdocs varied portals access level

Postby Sharley » 02. December 2011 20:49

My os is windows xp. I doubt if .htaccess will work with it
.htaccess files are not OS dependant but rather are server dependant, as I explained they are an extension to the server configuration file httpd.conf on a directory by directory (folder by folder) basis.

htaccess.txt is purely a Windows issue because it does not know what a dot file is and so baulks at creating or editing then saving a file such as .htaccess - usually overcome by using in a text editor the Save As.. function and then the All files (*) setting - htaccess.txt will not be recognised by Apache only .htaccess has that privilege. :)


I am assuming nothing has changed and all the folders you are using the .htaccess files in are located in the htdocs (DocumentRoot) tree.

The <Limit> directive docs.
http://httpd.apache.org/docs/2.2/mod/core.html#limit

The order directive docs.
http://httpd.apache.org/docs/2.2/mod/mo ... html#order

The order, allow and deny directives are all on the same docs page so are easily referenced.

I have provided the links to the docs so you can better understand what you are trying to achieve.

Here is a link to the full list of directives:
http://httpd.apache.org/docs/2.2/mod/directives.html
and the quick reference guide:
http://httpd.apache.org/docs/2.2/mod/qu ... rence.html

Remember that all things Apache are case sensitive so <Limit>...</LIMIT> may also give an error.

So for your example that you posted please consult the docs for explanations
Code: Select all
<Limit GET HEAD POST>
order allow,deny
allow from all
deny from xxx.xxx.xx.xxx
</Limit>

Any errors that may occur from a .htaccess file are often explained in the \xampp\apache\logs\error.log file.

Best wishes. :)
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 35 guests