我正在尝试创建一个 htaccess 文件来重定向我的整个网站(除了一些例外),但我无法让它工作。我需要重定向整个内容,提供特定的重定向,并排除两个页面。以下是我的非工作示例。谢谢!
RewriteCond %{REQUEST_URI} !^/events/index.html
RewriteCond %{REQUEST_URI} !^/calendar/index.html
Redirect 301 /info/faq.html http://mynewsite.com/my-page
Redirect 301 / http://mynewsite.com
你正在尝试混合mod_rewrite
with mod_alias
,但是RewriteCond
陈述不能条件化Redirect
语句,因为它们不是来自同一个模块。
如果我正确理解了您想要实现的目标,我相信您想要更多类似的东西:
RewriteEngine On
RewriteCond %{REQUEST_URI} !=/events/index.html
RewriteCond %{REQUEST_URI} !=/calendar/index.html
RewriteCond %{REQUEST_URI} !=/info/faq.html
RewriteRule ^.*$ http://mynewsite.com/$0 [R=301,L]
Redirect 301 /info/faq.html http://mynewsite.com/my-page
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)