.htaccess 403使用htaccess重写时出错

.htaccess 403使用htaccess重写时出错,.htaccess,mod-rewrite,url-rewriting,.htaccess,Mod Rewrite,Url Rewriting,我有一个htaccess文件,它将所有请求重定向到/public/index.php AuthType Basic AuthName "Access to /testsite" AuthUserFile /kunden/homepages/28/d446685396/htpasswd Require user oglover RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQU

我有一个htaccess文件,它将所有请求重定向到/public/index.php

AuthType Basic
AuthName "Access to /testsite"
AuthUserFile /kunden/homepages/28/d446685396/htpasswd
Require user oglover

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . public/index.php [L]
它适用于所有请求,例如www.mywebsite.com/aboutus、www.mywebsite.com/contact、www.mywebsite.com/news等。。。。但是如果我访问www.mywebsite.com/我会得到一个403禁止的错误。一切都很好,直到我换了一个新的网络主机,我不知道如何解决这个问题

RewriteRule . public/index.php [L]
此规则中的正则表达式为
,表示“字符串中任何位置的任何单个字符”,这会导致出现问题。当您请求
www.mywebsite.com/
时,正则表达式与空字符串匹配(请参见手册中的)。正则表达式不匹配,因此未应用该规则,因此服务器尝试提供根的索引,这是禁止的

要匹配所有内容,请将规则更改为以下内容:

RewriteRule .* public/index.php [L]
*
表示“零个或多个字符”,与空字符串不匹配