除非指向index.php,否则无法获取应用程序以使用htaccess

我有困难让我的应用程序之一,使用其path内的htaccess文件,除非我直接指向index.php浏览器

我已经在我的电脑上安装了ubuntu:

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

我在我的电脑上安装了apache:

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

我已经尝试将下面的代码添加到我的/etc/apache2/apache2.conf

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

我也试过这样的:

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

如您所见,此代码指向位置/var/www/html/pss 。 在我的pss folder有一个html文件夹。 在这个html文件夹里面我有一个.htaccessindex.php文件。

如果我指向我的浏览器http:// localhost / pss / html它不起作用,但如果我去http://localhost/pss/html/index.php它似乎工作

我在我的htaccess里面添加了一条指令: DirectoryIndex index.php 。 这没有奏效。 这是我的.htaccess文件:

 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] 

它位于/var/www/html/pss/html/.htaccess

从我可以看到它使用htaccess时,我去的url / index.php但不是当我只是去自己的url

如果您需要任何进一步的信息,请让我知道。

请注意,您放置在apache2.conf文件中的“AllowOverride”指令控制用户是否能够通过.htaccess文件修改networking服务器的行为。

通过设置为无,你本质上阻止你的.htaccess有任何效果! 你很可能想把它设置为全部,或者例如索引,因为你试图改变索引参数。

最后,如果您有权访问Web Server,则还可以直接在Apache2configuration文件中设置这些参数。 .htaccess文件的主要用途是用于共享Web主机,其中用户无权访问Web服务器configuration。