htaccess 重写到新域 [英] htaccess rewrite to new domain

查看:31
本文介绍了htaccess 重写到新域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个:

Options -Indexes
RewriteEngine On
RewriteCond %{HTTP_HOST} ^findmyfiver.com$ 
RewriteRule (.*) http://www.findmyfiver.com/$1 [L,R]

成功地强制用户访问网站上的 www. 版本;但是我想在用户进入时将用户重定向到特定的域和页面:

Which successfully forces a user to the www. version on the site; however I want to redirect a user to a specific domain and page when they enter:

findmyfiver.com/tester.php to findmyfiver.co.uk/tester.php

这是怎么做到的?

推荐答案

Options -Indexes
RewriteEngine On
RewriteCond %{HTTP_HOST} ^findmyfiver.com$ 
# Add a rule to rewrite tester.php to a different domain
# Before your other catch-all rule
RewriteRule ^tester.php http://findmyfiver.co.uk/tester.php [L,R=301,QSA]
RewriteRule (.*) http://www.findmyfiver.com/$1 [L,R]

这篇关于htaccess 重写到新域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆