简单的重定向Apache的无限循环重定向、简单、Apache

2023-09-02 00:56:56 作者:信什么不好信爱情

我'用下,我在%XAMPP_ROOT%/ htdocs中放置.htaccess中的Windows 7的XAMPP。的.htaccess包含如下因素行:

I'am using xampp under the windows 7. I've placed .htaccess in the %XAMPP_ROOT%/htdocs. .htaccess contained the folowing line:

Redirect / http://localhost/test.php/

打字 HTTP后://本地主机到浏览器的地址栏中我有一个infinte回路误差为 http://localhost/test.php/test.php/test.php/test.php/test.php/test.php/test.php/test.php/test.php/test.php/test.php/test.php/test.php/test.php/test.php/test.php/test.php/test.php/test.php/test.php/.但我预计我重定向到的http://localhost/test.php/

After the typing http://localhost into the browser's address field I've an infinte loop error to a http://localhost/test.php/test.php/test.php/test.php/test.php/test.php/test.php/test.php/test.php/test.php/test.php/test.php/test.php/test.php/test.php/test.php/test.php/test.php/test.php/test.php/. But I'm expected that I'm redirected to http://localhost/test.php/.

推荐答案

您应该使用 RedirectMatch 为避免这种情况下使用正则表达式:

You should use RedirectMatch for avoiding this scenario using regex:

RedirectMatch ^/?$ http://localhost/test.php/