Board index   FAQ   Search  
Register  Login
Board index System Administration Server installation and configuration

Restrict user access using .htaccess

Discuss server installationa nd configuration issues here

Moderators: macek, egami, gesf

Restrict user access using .htaccess

Postby thandono » Sat Jan 21, 2012 1:09 am

Under the root directory, I have the following directory structure;

index.php
phpmyAdmin/
application_1/
application_2/

I want to restrict user access. So if not from the localhost, all users are forced to access index.php and not allowed to access all the directories (phpMyAdmin, and so on).

I think about using .htaccess but haven't found the right code.

Is there any bad effects if you use "AllowOverride All" in httpd.conf ?
thandono
New php-forum User
New php-forum User
 
Posts: 44
Joined: Sun Jan 01, 2012 3:06 am

Re: Restrict user access using .htaccess

Postby thandono » Sat Jan 21, 2012 7:19 am

Ok, I found this:

Code: Select all
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REMOTE_HOST}!^127\.0\.0\.1
RewriteCond %{REQUEST_URI}!/index\.php$
RewriteRule \.html$ /index.php [R=302,L]


and I'm gonna test it
thandono
New php-forum User
New php-forum User
 
Posts: 44
Joined: Sun Jan 01, 2012 3:06 am

Re: Restrict user access using .htaccess

Postby TheProdigyGuy » Sun Jan 22, 2012 7:51 pm

Well, it depends for which configuration element it applies(httpd.conf it has several)

Code: Select all
#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#

#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.2/mod/core.html#options
    # for more information.
    #
    # enabled dir listing disabled by me : # Options Indexes FollowSymLinks
     Options Includes FollowSymLinks MultiViews

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
   AllowOverride All
    #AllowOverride None

    #
    # Controls who can get stuff from this server.
    #
    Order allow,deny
    Allow from all

</Directory>


As you can see:
AllowOverride All
uncommented

and it has a bit security risk(Why?)
Because attacker can force any extension using .htaccess force to execute!
This is a well known 'hacking' way of web servers( for execute CGI,Perl etc etc nasty things!)
+ It doesn't depends on web servers OS (It will be WIndows,Linux as well!)

Regarding of your question:
It should do it for you:(.htaccess)
Code: Select all
RewriteEngine On
RewriteCond %{REMOTE_ADDR} !^127.0.0.1$
RewriteRule ^(dir1/|dir2/)(.*)$ /$1 [F,NE,L]


#[F,NE,L] you can simply change that F (forbidden) flag to R (redirect aka HTTP MOVE 302)
#+ You have to change that dir1/ and dir2/ to your in ex: phpmyadmin/ etcdir/
Place it to root of htdocs and save thats all!
But it is a best practice(do not use default MYSQL root password which comes with LAMP WAMP VERTIGO) and change it immediately)
Because that 'wholes' can compromise completely your OS+execute some nasty virii's on your system)
And yes it is real!

Cheers.
TheProdigyGuy
New php-forum User
New php-forum User
 
Posts: 215
Joined: Wed Dec 07, 2011 5:25 pm

Re: Restrict user access using .htaccess

Postby llj000 » Mon Apr 09, 2012 7:24 am

Well, it depends for which configuration element it applies(httpd.conf it has several)
llj000
New php-forum User
New php-forum User
 
Posts: 1
Joined: Mon Apr 09, 2012 7:02 am

cheapest Herve Leger on sale (24)

Postby griffis99 » Sun May 12, 2013 3:37 am

What do you want people to think about when they hear your herve leger wedding name? Do you want to be thought of as a genius, a creative artist, a skilled athlete, or an expert in a certain field?
You can definitely achieve that. Here's how:
Associate yourself with the person you would like to be connected with.
If you want to be thought of as an energetic person, exude energy in your actions. Let people see for themselves how you are "full of vitality". Ok, that's obvious; but people often forget to "act accordingly."
More importantly, the words you speak will have a big influence in herve leger atlanta the way people will perceive you.
Talk about wealth all the time and people will associate you with wealth. Talk about goalsetting often and people will perceive you as a goalsetting authority.
So what you need to do is know everything you can about what you want people to associate you with, then talk about it often. Don't just talk about it, flaunt it! BE IT! Express it through your actions and behavior.
On the other hand, if you often talk about your poor situation or how you hate your life, people will see you as a whiner who puts yourself down. They would avoid you to save themselves from catching your "disease," unless they feel the same way as you do.
As you know, "Birds of the same feather flock together." People want to be with people who are similar (in thought or behavior) to themselves.
But that doesn't mean that if you have been used to be in the company of negative people, you are herve leger bandage dress knock off stuck in the rut forever. herve leger fall 2011 You can still change anything.
Remember, you are the master of your destiny and life. You can get whatever you want.
If you want to be successful, be friends with successful people and associate with them often. In time, you will subconsciously attract their aura, their mindset, their personality into your own.
If you're not comfortable being with them, take it little by herve leger dress for sale little. Some peole would feel awkward or belittled when they're in the company of "bigger" people. But let me ask you..
"Are you serious in becoming successful?"
If you are, then do it, even if just one step at a time. Don't let fear stop you from attaining your fullest potentials in life.
Maybe you can ask them if they would like to join you for dinner, or ask them for advice on a certain topic. People who know a certain topic would be very happy to share their knowledge and "show off." I do mean that in a positive way.
Better yet, apply the Law of Reciprocity. Think of ways in which you can do something nice for them. But don't expect anything from them; or worse, demand that they return the favor. Just do your thing and let them decide for themselves if they want to return the favor.
What about those negative people you've been hanging out with? Well, don't trash them. That's going to hurt your relationships.
Just try to avoid them as much as you can and focus on improving your life. Learn to be a human filter by blocking all negative words or thoughts from entering your subconscious. The key word is focus. Focus on the positive, eliminate the negative.
And why not influence negative people to acquire your positive personality? Once you've acquired that success mindset, share your knowhow and aura with those who need it. That would be a very noble act what is herve leger indeed.

Related articles:


cheapest Herve Leger on sale (49)
griffis99
New php-forum User
New php-forum User
 
Posts: 40
Joined: Mon Dec 17, 2012 12:41 am


Return to Server installation and configuration

Who is online

Users browsing this forum: No registered users and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.