How to set Apache configurations in .htaccess file - apache

I build a small project and it s working fine in Localhost, but not in a Share Hosting because of some configurations in the Apache config file.
Because this Hosting Service doesn't allow access to httpd.conf file, i could only use .htaccess file to do it.
My config in the local environnent:
<Directory "/path/to/the/site/directory/">
Options Indexes
FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
I have tried to use a htaccess file like below:
Options -Indexes
FollowSymLinks MultiViews
AllowOverride All //seems not to be working
Require all granted
I would really appreciate it if anyone can help. Thanks so much.

Related

htaccess to disable directory browsing in Apache/2.4.10 (Debian) doesn't work

I create a .htaccess file with this content: (in the folder of the site)
#Disable directory indexes
Options -Indexes
But I still see the directories in the browser.
And in apache2.conf I rewrite this:
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
What did I do wrong?
If that didn't work and you got no error then it looks like .htaccess files are not enabled on your server. You'll need something like AllowOverride All in the server config that controls this area of the filesystem.
At the very least you would need the following to permit just that one directive.
AllowOverride Options=Indexes

How to allow Apache to serve files outside of the document root folder?

everybody. TIA for your help.
All of my projects are located in /var/www/html and my apache.conf points to it with the following directive:
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
By mistake I created another project in ~/Development/My_Project.
And I tried to get apache to serve the files using the following directive (right after the one above):
<Directory /Development/My_Project/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
But it does not work. I get:
Forbidden
You don't have permission to access / on this server.
I appreciate any help.
Thanks

Apache : Directory index forbidden by Options directive:/srv/www/htdocs/testFolder

Saw duplicate questions and solutions, does not seem to solve the below problem
I am trying to allow access to a folder through apache, and the /var/log/apache2/ throws the above error.
My httpd.conf is
# forbid access to the entire filesystem by default
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Allow from all
</Directory>
I tried with Options +Indexes, Options All which doesnt seem to work. Tried to change permissions of the folder too. Added a dummy index.html in the folder as well
The folder is located at /srv/www/htdocs/testFolder.
Any ideas?
had to add files explicitly the files in the conf file
<Directory /srv/www/htdocs/HDP-UTILS-1.1.0.20>
Options +Indexes
</Directory>
<Directory /srv/www/htdocs/HDP>
Options +Indexes
</Directory>
I resolved a similar where Apache was throwing 403 error while trying to access the index.html file the issue was resolved by creating a index.hmtl in /srv/www/htdocs directory.
url: http://localhost:80/
The Suse Apache didn't create a index.html file by default don't know why.
Change your config to
Options -Indexes FollowSymLinks
AllowOverride All
Order allow,deny
allow from all
After that create an .htaccess file in your folder and add
Options +Indexes
to it. You probably need to reload your apache.

.htaccess not workingn on Ubuntu

I have tried several things now but my .htaccess file still seems to be having no affect on the website.
in apache2/apache2.conf I have changed AllowOverride to ALL
I have copied the following into my default file in sites-available
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
I have also added the following into my sites conf file in sites-enabled...
<Directory /var/www/html/mysite>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
But still nothing!
I have also checked phpinfo() for the server and mod_rewrite is appearing in the loaded modules
I have also made sure to restart apache.

Laravel 4 - Options not allowed here in the .htaccess

I have installed Laravel 4 on my public_html folder locally, and I can access its public folder when declaring a vhost pointing to it, through the vhost url.
But, when I try to access Laravel public folder through its parent folders, I get an error in apache logs (error_log): $LARAVEL_HOME/public/.htaccess: Options not allowed here. Even if there is a AllowOverride All in $VHOST_CONF/site.
The first line in the .htaccess (Options Multiviews), is causing this error when I delete it, or put it in $VHOST_CONF/site, it works.
So, How do I do to I access through the hierarchy, without modifying the .htaccess file?
In the Apache configuration file for the website set AllowOverride to AllowOverride All similar to the following:
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
# changed from None to All
AllowOverride All
Order allow,deny
allow from all
</Directory>