Solved

Is there a way to prevent the localhost from reading the .htaccess file?

Posted on 2010-11-25
8
379 Views
Last Modified: 2012-05-10
Hi,

Is there a way to prevent the localhost (my winLAMP testing server) from reading the .htaccess files in the directories?

Thanks
0
Comment
Question by:peps03
  • 4
  • 3
8 Comments
 
LVL 1

Expert Comment

by:psalkiew
ID: 34212355
Add:

Allowoverride none

directive to <Directory> definition.

0
 

Author Comment

by:peps03
ID: 34212529
Hi psalkiew!

Thanks for your reply. I found a lot of <Directory> tags..
and some more: "Allowoverride"

Could you be a little more specific? what lines are in front for example?
I have to edit the "httpd.config"-file right?

thanks
0
 
LVL 10

Expert Comment

by:MadShiva
ID: 34212577
Dear peps03,

See this page for the explanation :

http://httpd.apache.org/docs/2.0/mod/core.html

Best Regards
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 1

Accepted Solution

by:
psalkiew earned 250 total points
ID: 34212579
Yes, you must edit the apache server configuration file (httpd.conf). There you must find Directory definition for the directories in which you want to restrict .htaccess files. For example:

        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>

This is the definition of the document root. When you change AllowOverride in this section to none the whole www server will stop reading .htaccess files.

When you have many sites, virtual servers or user directories you must find the appropriate <directory> definition and change the AllowOverride value in desired place.
0
 

Author Comment

by:peps03
ID: 34212781
I found it..

But setting "all" to "none" is not working.. the .htaccess files are still followed.

I am running apache on my computer with several folders in the root, each folder contains a website with also a .htaccess file.

thanks
0
 

Author Closing Comment

by:peps03
ID: 34214289
Thanks psalkiew!

This was the solution that worked!

I had to restart apache AND the browser..

Rookie mistake..

Thanks!
0
 
LVL 1

Expert Comment

by:psalkiew
ID: 34215908
Any changes to httpd.conf require apache restart - this file is parsed only on startup.
0
 

Author Comment

by:peps03
ID: 34216952
i know, i did that. but i also had to restart my browser apparently..

thanks for the help!
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you are running a LAMP infrastructure, this little code snippet is very helpful if you are serving lots of HTML, JavaScript and CSS-related information. The mod_deflate module, which is part of the Apache 2.2 application, provides the DEFLATE…
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question