0

I am having difficulty getting one of my applications to use the htaccess file inside its path unless i point directly to index.php in the browser

I have installed on my computer ubuntu:

Distributor ID: Ubuntu
Description:    Ubuntu 15.10
Release:    15.10
Codename:   wily

I have installed on my computer apache:

Server version: Apache/2.4.12 (Ubuntu)
Server built:   Jul 24 2015 15:59:11

I have tried adding the following code to my /etc/apache2/apache2.conf

<Directory /var/www/html/pss/>
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>

I also tried it like this too:

<Directory /var/www/html/pss/html>
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>

As you can see, this code points to the location /var/www/html/pss. Inside my pss folder i have an html folder. Inside this html folder I have an .htaccess and index.php files.

If I point my browser to http://localhost/pss/html it does not work however if i go to http://localhost/pss/html/index.php it seems to work

I added inside my htaccess an instruction: DirectoryIndex index.php. This did not work. Here is my .htaccess file:

SetEnv APPLICATION_ENV development
DirectoryIndex index.php
php_value session.auto_start 0
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

It sits at /var/www/html/pss/html/.htaccess

From what I can see it uses the htaccess when i go to the url/index.php but does not when i just go to the url by itself

If you need any further information please let me know.

Starfish
  • 2,735
  • 25
  • 28
slicks1
  • 11
  • 2
  • I'm voting to close this question because because Serverfault should not be expected to provide Reading Manuals as a Service. – user9517 Feb 15 '16 at 06:56

1 Answers1

2

It's important to note that the "AllowOverride" directive you've put in your apache2.conf file controls whether or not the users will be able to modify the webserver's behaviour through the .htaccess file.

By setting it to None, you're essentially preventing your .htaccess from having any effect ! You most likely want to set it to All, or for example Indexes since you're trying to change Indexing parameters.

Finally, you can also set those parameters directly in the Apache2 configuration file if you have access to the Web Server. The primary usage of the .htaccess file is for use on Shared Web Hosts where an user does not have access to the web server configuration.

Fira
  • 301
  • 1
  • 3