最近,我们改变了一个子域的名称,现在我们需要重定向所有的旧网页到新的子域名的页面。
例如网页链接:
旧网址:http://jquery.web$c$chelpers.com/2013/08/what-does-dollar-sign-means-in-jquery.html
新网址:http://uieiq.web$c$chelpers.com/2013/08/what-does-dollar-sign-means-in-jquery.html
我的发现:当我尝试访问的子域的顶层是工作好
要如何把旧子域中的所有网址到新的子域名?
目前,我有以下code的.htaccess文件,请引导来解决问题。
RewriteEngine叙述上
的RewriteCond%{HTTP_HOST} ^ jQuery的名.web codehelpers .COM $ [OR]
的RewriteCond%{HTTP_HOST} ^ WWW .jquery 名.web codehelpers .COM $
重写规则^ / $?HTTP : / / uieiq 名.web codehelpers .COM /搜索 /标签 / jQuery的访谈问题[R = 301,L]
解决方案
启用的mod_rewrite
和的.htaccess
到的httpd.conf
,然后把这个code在 DOCUMENT_ROOT /的.htaccess
文件:
RewriteEngine叙述上
的RewriteCond%{HTTP_HOST} ^ jQuery的名.web codehelpers .COM $ [NC]
重写规则^ HTTP://uieiq.web$c$chelpers.com% {REQUEST_URI} [L,R = 301,NE]
请阅读: URL重写简介
![为什么我家不能上百度 老提示域名重定向 我弄过了IE修复 可还是不能用](https://p.xsw88.cn/allimgs/daicuo/20230902/656.png)
Recently we changed the name of a subdomain, now we need to redirect all the old pages to the new subdomain pages.
Example page links:
Old URL: http://jquery.webcodehelpers.com/2013/08/what-does-dollar-sign-means-in-jquery.html
New URL: http://uieiq.webcodehelpers.com/2013/08/what-does-dollar-sign-means-in-jquery.html
My findings: when I try to access the subdomain in the top level it is working good.
How can I redirect all URLs on the old subdomain to the new subdomain?
currently i have the below code in .htaccess file , please guide to solve the problem
RewriteEngine on
RewriteCond %{HTTP_HOST} ^jquery.webcodehelpers.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.jquery.webcodehelpers.com$
RewriteRule ^/?$ "http://uieiq.webcodehelpers.com/search/label/jquery interview questions" [R=301,L]
解决方案
Enable mod_rewrite
and .htaccess
through httpd.conf
and then put this code in your DOCUMENT_ROOT/.htaccess
file:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^jquery.webcodehelpers.com$ [NC]
RewriteRule ^ http://uieiq.webcodehelpers.com%{REQUEST_URI} [L,R=301,NE]
Please read: Apache mod_rewrite Introduction
相关推荐
最新文章