【发布时间】:2015-01-13 05:58:15
【问题描述】:
我目前正在使用一些名为sendy 的软件。我想将 url mydomain.com/sendy 重定向到根目录中的 sendy 文件夹。我在一个共享帐户上使用 Laravel,并在下面的配置之后使用其他 htaccess 配置。结果,我将 sendy 重定向放在首位。但是我得到了错误
The website has a redirect loop
我不是 .htaccess 文件方面的专家,因此对于可能导致问题的原因,任何帮助都会非常有用。我现在拥有的如下所示:
# Use PHP5.4 as default
AddHandler application/x-httpd-php54 .php
#AddType application/x-httpd-php54 .php
RewriteEngine on
RewriteRule ^/?sendy/ /sendy/? [R=301,L]
RewriteCond %{HTTP_HOST} ^(www.)?mydomain.com$
RewriteCond %{REQUEST_URI} !^/public/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /public/$1
RewriteCond %{HTTP_HOST} ^(www.)?mydomain.com$
RewriteRule ^(/)?$ public/index.php [L]
谢谢!
【问题讨论】:
-
这条规则背后的意图是什么?这绝对是重定向循环,因为您将
/sendy重定向到/sendy -
访问文件夹 sendy,并且不使用以下用于 Laravel 的配置(虚线)进行重定向
标签: php .htaccess mod-rewrite redirect laravel-routing