Disable directory browsing apache isn't working - apache

I want to disable directory browsing in WordPress. But it's not working.
Please help me. I've already edit htaccess (Options -Indexes)
This is folder httpd
<Directory "${INSTALL_DIR}/www/">
#
# 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.4/mod/core.html#options
# for more information.
#
Options +Indexes +FollowSymLinks +Multiviews
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
#
AllowOverride all
#
# Controls who can get stuff from this server.
#
# onlineoffline tag - don't remove
Require all granted
</Directory>
<Directory ${INSTALL_DIR}/www/wp-includes>
Options -Indexes
AllowOverride None
Order allow,deny
</Directory>

There is some inconsistency in your config file. I'm thinking that
<Directory ${INSTALL_DIR}/www/wp-includes>
Should actually be
<Directory "${INSTALL_DIR}/www/wp-includes/">
Notice the missing " quotes and /
Also
AllowOverride all
should be
AllowOverride All
Notice the capital A on All
If that doesn't fix your problem let me know what version of Apache and is this Windows or Linux.

Related

Typo 3 login Not Found The requested URL was not found on this server

I'm new to typo3.
After installation and after login to admin I keep getting
Not Found
The requested URL was not found on this server.
I've seen the solution on Typo 3 installation ended with URL Not Found but can't figure out which .htaccess file to modify. There are many .htaccess files.
I'm facing not found error on both front end and admin. I've installed latest version.
I installed typo3 by following instructions here
https://docs.typo3.org/m/typo3/tutorial-getting-started/11.5/en-us/Installation/Install.html#install
Thanks to #thomas-löffler for pointing it out.
It turns out that there was issue with apache configuration. The solution is to add following in httpd.conf
AllowOverride All
Order deny,allow
Allow from all
Don't forget to restart apache afterwards.
$sudo vi /etc/apache2/httpd.conf
....
DocumentRoot "/Users/imac/ROOT/WebRoot"
<Directory "/Users/imac/ROOT/WebRoot">
#
# 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.4/mod/core.html#options
# for more information.
#
Options FollowSymLinks Multiviews
MultiviewsMatch Any
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
#
#AllowOverride None
AllowOverride All
Order deny,allow
Allow from all
#
# Controls who can get stuff from this server.
#
Require all granted
</Directory>
......

Mod Rewrite enabled and AllowOverride set to All, but .htaccess still not working

I'm running Apache 2.4.6 on Centos 7. As the title says, I've verified that mod rewrite is enabled, and this is what my httpd.conf looks like
<Directory "/var/www/html">
#
# 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.4/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# 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
#
# Controls who can get stuff from this server.
#
Require all granted
</Directory>
But for some reason, my .htaccess still isn't working. Right now I'm just putting all my instructions in the same Directory element (I didn't copy that part, and I know it's not the issue because I only did it as a last resort after not being able to get the .htaccess to work). If anyone can help it would be greatly appreciated.

Changed Apache configurations, now localhost/~username/index.php throws 403 Error

I have been struggling to get laravel php framework up and running on my mac with yosemite. I have made changes to both the httpd.conf file in /etc/apache2 as well as my user config file username.conf. Now after changing it back I get a 403 "Forbidden You don't have permission to access /~username/my_phpinfo.php on this server." Also I should not that I am using Apache/2.4.9. This is the user conf file I currently have:
<Directory "/Users/<username>/Sites/">
AllowOverride All
Options Indexes FollowSymLinks
Require all granted
</Directory>
I also feel like possible errors could be in this section (line number~=238) of the httpd.conf file:
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/Library/WebServer/Documents"
<Directory "/Library/WebServer/Documents">
#
# 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.4/mod/core.html#options
# for more information.
#
Options FollowSymLinks Multiviews
MultiviewsMatch Any
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
#
AllowOverride all
#
# Controls who can get stuff from this server.
#
Require all granted
Order allow,deny
Allow from all
</Directory>

Can't access website from outside?

So I can't access my website from outside for some reason. I've tried the command "ping xxx" from cmd but I get a timeout. I can access the database from outside though. I have port-forwarded 80 and also tried turning off my firewall & allowing port 80 TCP/UDP both in and out.
I can access it locally (from my computer and on the same network)
My httpd.conf looks like this:
<Directory "D:/wamp/www/">
#
# 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.4/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
#
AllowOverride all
#
# Controls who can get stuff from this server.
#
# onlineoffline tag - don't remove
Order allow,deny
Allow from all
Deny from none
</Directory>
Any ideas of how I can fix this?
Try replacing this Apache 2.2 syntax with Apache 2.4 syntax.
From
Order allow,deny
Allow from all
Deny from none
To
Require all granted

Share localhost on LAN, WAMP

I have a simple PHP project just php and apache, and i want to share this project on my localnetwork, how i can figure this out?
I've try some solutions founded here but can't make it work.
Someone have any ideia?
I've already change my httpd.conf from apache folder to:
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Allow from all
</Directory>
And changed:
Listen 80
to:
Listen 192.168.50.1:80
But don't work either.
Well change it all back.
This change allows access to the root directory of the drive you installed wamp onto. NOT A GOOD IDEA. S change it back to :
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
and also back to
Listen 80
Assuming you website is in c:\wamp\www and if your subnet is in fact 192.168.50 like you have used above the simple way to allow access to your site over the local network only is to change this part of httpd.conf
Look for
<Directory "c:/wamp/www/">
#
# 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.
#
Options Indexes FollowSymLinks
#
# 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
#
# Controls who can get stuff from this server.
#
# onlineoffline tag - don't remove
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</Directory>
And change this part of that section
# onlineoffline tag - don't remove
Order Deny,Allow
Deny from all
Allow from 127.0.0.1 ::1 localhost
Allow from 192.168.50
the line Allow from 192.168.50 will allow access from any ip on that subnet i.e. 192.168.50.1 -> 192.168.255
If you put your site into a subfolder then do this:
<Directory "c:/wamp/www/">
#
# 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.
#
Options Indexes FollowSymLinks
#
# 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
#
# Controls who can get stuff from this server.
#
# onlineoffline tag - don't remove
Order Deny,Allow
Deny from all
Allow from 127.0.0.1 ::1 localhost
</Directory>
<Directory "c:\wamp\www\sitefolder">
Options Indexes FollowSymLinks
AllowOverride all
Allow from 192.168.50
</Directory>
This will keep your wampserver homepage secure but allow access to the site in sitefolder to everyone in the local network.