htaccess重写迁移其他域 [英] htaccess rewrite migrate different domain

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

问题描述

如何使用htaccess模块​​重写来更改传入链接的基本域?

How do I change the base domain of an incoming link using htaccess module rewrite?

传入网址:

www.foo.com/bar?name1=value1&name2=value2

重写的网址:

www.newFoo.com/bar?name1=value1&name2=value2

Apache Web服务器应该简单地重写其所有传入的URL,因为Web服务器本身不再保存任何网站。

Apache webserver should simply rewrite all of its incoming urls, on the webserver itself no websites are saved anymore.

推荐答案

将其添加到您的Web根 .htaccess 中托管 www.foo.com

Add this to your .htaccess in your web root / directory of the server hosting www.foo.com

RewriteEngine on

RewriteCond %{HTTP_HOST} ^(www\.)?foo\.com$ [NC]
RewriteRule ^(.*)$ http://www.newfoo.com/$1 [R=301,L]

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

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