将此添加到.htaccess文件后,Index.php页面不工作

将此添加到.htaccess文件后,Index.php页面不工作,php,.htaccess,Php,.htaccess,创建此.htaccess文件后 ErrorDocument 404 localhost/website/error404.html RewriteEngine On RewriteRule ^([0-9A-Za-z-]+)/?$ users.php?name=$1 [NC,L] 如果我在网站内打开一个文件夹,如:localhost/website/user 然后它将我重定向到错误404页面。我需要键入localhost/website/user/index.php才能打开它。如何修复呢?

创建此.htaccess文件后

ErrorDocument 404 localhost/website/error404.html 

RewriteEngine On
RewriteRule ^([0-9A-Za-z-]+)/?$ users.php?name=$1 [NC,L] 
如果我在网站内打开一个文件夹,如:
localhost/website/user

然后它将我重定向到错误404页面。我需要键入
localhost/website/user/index.php
才能打开它。如何修复呢?

你们写了RewriteBase吗?我刚刚添加了.htaccess文件,仅此而已。如果我删除第2行和第3行,它将在所有URL中运行。index.php但是我以前会被重定向到users/index.php,如果我只键入/users,但现在,我需要键入whole users/index.php