如何使用 .htaccess 将单个网页从一个域重定向到另一个域 [英] How to redirect a single web page from one domain to another using .htaccess

查看:25
本文介绍了如何使用 .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 将单个网页从一个域重定向到另一个域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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