Apache 未指定index.php,无法访问目录
我想让我的应用程序根目录可以在不指定index.php的情况下访问Apache 未指定index.php,无法访问目录,apache,.htaccess,mod-rewrite,Apache,.htaccess,Mod Rewrite,我想让我的应用程序根目录可以在不指定index.php的情况下访问 www.domainname.com/dev/ 我的.htaccess现在是 <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?/$1 [L] </If
www.domainname.com/dev/
我的.htaccess现在是
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
重新启动发动机
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则^(.*)$index.php?/$1[L]
在我的本地主机上它可以工作,但在我的主机上,当我访问时,它会说“目录访问是禁止的”
我应该换什么
这可能会解决问题 在根目录下的.htaccess文件中添加如下内容:
DirectoryIndex index.php index.html
默认情况下,将从左到右加载找到的第一个文件。您可以根据需要添加更多文件或删除index.html。这只是一个例子