我有域example.com和域example.fr。
我通过以下方式将example.fr重定向到example.com:
<?php
header('location: www.example.com');下面是我想要做的事情的伪代码:
example.com的htaccess
if HTTP_REFERER equals 'example.fr'
redirect to example.com/fr我之所以想在.com的htaccess (而不仅仅是在.fr的头位置)中这样做,是因为我有很多域,我希望通过编辑根域中的路由来保持简单,而不是在每个域中。
我试过:
RewriteEngine on
RewriteCond %{HTTP_REFERER} example\.fr [NC]
RewriteRule /fr [R,L]但到目前为止没有运气..。
对如何解决这个问题有什么想法吗?
发布于 2014-07-24 11:58:49
在根.htaccess中尝试以下规则:
RewriteEngine on
RewriteCond %{HTTP_REFERER} example\.fr [NC]
RewriteRule ^ http://example.com/fr%{REQUEST_URI} [NE,R=302,L]https://stackoverflow.com/questions/24932859
复制相似问题