RedirectMatch(。*)domain.com/folder不起作用。它给我“页面没有正确重定向”错误ff。将所有页面重定向到临时页面
有人有解决方案吗?尝试了像重写一些不同的方式,但我不断收到这些重定向错误和500错误。
RedirectMatch(。*)domain.com/folder不起作用。它给我“页面没有正确重定向”错误ff。将所有页面重定向到临时页面
有人有解决方案吗?尝试了像重写一些不同的方式,但我不断收到这些重定向错误和500错误。
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/folder(.*)$ [NC]
RewriteRule ^(.*)$ http://domain.com/folder [R=301,L]
R是重定向类型(永久/ Tmeporary)。 L表示如果匹配,则停止处理遵循此规则的更多规则。
另外,在你的httpd.conf中,如果你想在.htaccess文件中而不是在自定义配置文件中设置AllowOverride All
。
或者,你可以把这个在您的index.html:
<script language=javascript>
location.replace("http://domain.com/folder");
</script>
试试这个:
Options +FollowSymlinks
RewriteEngine On
RewriteBase/
RewriteCond %{REQUEST_URI} !^/folder$
RewriteRule ^(.*)$ http://domain.com/folder [R=301,L]
如果仅使用此规则RewriteRule ^(.*)$ http://domain.com/folder [R=301,L]
Apache会落在一个循环,所以你得到的消息:
The page isn't redirecting properly
是的,我试过了。它仍然给了我“页面没有正确重定向”的错误。 –
确保您的“AllowOverride”设置为“全部”,而不是设置为“无”。另外,确保/。文件夹的.htaccess/.conf中没有重写规则可能会冲突或导致重写循环。 – chown
这完全没有设置,它可以默认为非? –