本文介绍了如何使用.htaccess将单个网页从一个域重定向到另一个域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使以下重定向生效?
How do I get the following redirect to work?
olddomain.com/employee-scheduling-software.html
重定向到
newdomain.us/employee-scheduling-software.html
我确实启用了mod_rewrite,但我基本上是该领域的新手
I do have mod_rewrite on, but I'm basically a complete novice in this area
推荐答案
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^employee-scheduling-software.html$ http://newdomain.example.org/employee-scheduling-software.html
</IfModule>
您可以将规则更改为:
RewriteRule ^employee-scheduling-software.html$ http://newdomain.example.org/employee-scheduling-software.html [R=301]
它将向浏览器发送301 Moved Permanently
标头,因此它会更新其书签和内容.
which will send a 301 Moved Permanently
header to the browser, so it updates its bookmarks and stuff.
这篇关于如何使用.htaccess将单个网页从一个域重定向到另一个域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!