重定向除“测试版”之外的所有流量子域到启动屏幕 (mod_rewrite)
我想将所有流量重定向到我的根域,根域是启动画面。我只想在 %{HTTP_HOST} 不是 beta.example.(com|es|fr) 时执行此操作。
所以我在我的 .htaccess 文件中尝试了以下内容,但没有运气...(无限循环...我猜它没有得到 REQUEST_URI 条件,但无法弄清楚为什么?我几乎尝试了所有方法
RewriteCond %{HTTP_HOST} !^beta\.example\.com$
RewriteCond %{HTTP_HOST} !^beta\.example\.es$
RewriteCond %{HTTP_HOST} !^beta\.example\.fr$
RewriteCond %{REQUEST_URI} !^/?$
RewriteRule ^.*$ / [NC,L,R=302]
)一点,我应该将除“beta”子域之外的所有流量重定向到根域。所以现在我想用我的启动屏幕重写“后台”根域,遵循 .htaccess 文件:
RewriteCond %{HTTP_HOST} !^beta\.example\.com$
RewriteCond %{HTTP_HOST} !^beta\.example\.es$
RewriteCond %{HTTP_HOST} !^beta\.example\.fr$
RewriteRule !\.(js|ico|txt|gif|jpg|png|css)$ splash.phtml [NC,L]
注意:我使用的是 Zend Framework,所以这些规则遵循 .htaccess 文件:
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
我必须说,我被困住了。
提前谢谢
I'd like to redirect all my traffic to my root domain, the root domain being a Splash screen. I'd like to do this ONLY when the %{HTTP_HOST} is not beta.example.(com|es|fr).
So I've tried the following in my .htaccess file, with no luck... (infinite loop... I guess it's not getting the REQUEST_URI condition, but cannot figure out why?? I've tried almost everything)
RewriteCond %{HTTP_HOST} !^beta\.example\.com$
RewriteCond %{HTTP_HOST} !^beta\.example\.es$
RewriteCond %{HTTP_HOST} !^beta\.example\.fr$
RewriteCond %{REQUEST_URI} !^/?$
RewriteRule ^.*$ / [NC,L,R=302]
At that point, I should have all my traffic but "beta" sub-domain redirected to the root domain. So now I'd like to Rewrite "backstage" the root domain with my Splash screen, following in the .htaccess file:
RewriteCond %{HTTP_HOST} !^beta\.example\.com$
RewriteCond %{HTTP_HOST} !^beta\.example\.es$
RewriteCond %{HTTP_HOST} !^beta\.example\.fr$
RewriteRule !\.(js|ico|txt|gif|jpg|png|css)$ splash.phtml [NC,L]
Note: I'm using the Zend Framework, so these rules are following in the .htaccess file:
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
I must say, I'm stuck.
thx in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
@bsagols
Zend 的这句话肯定会把你搞砸。
您需要将指令放在此之上(如果不是放在所有 Zend 内容之上的话)。如果我理解正确,请尝试以下操作:
@bsagols
This line from Zend is going to screw you up for sure.
You need to put your directives above this, if not above all of the Zend stuff. If I'm understanding you correctly, try this: