重定向旧域的子目录通过htaccess的新域的根文件夹子目录、文件夹、重定向、htaccess

2023-09-02 10:05:11 作者:滴情不沾

我已经经历了一些站点重复了就一个字preSS博客并希望得到重定向到新域旧链接。最初,博客是

  olddomain.com/blog/
 

现在的博客是在根级别

  newdomain.com
 

旧域设置为新域的域别名,它不转发。

win7中如何建.htaccess文件

如果任何人访问该网站

  olddomain.com/blog/
 

我需要重定向到

  newdomain.com/
 

感谢您的帮助。

解决方案

刚刚创建.htaccess文件并把它夹在你想从重定向 例如把它在 /博客文件夹。

以下行添加到您的.htaccess文件。

RewriteEngine叙述在

的RewriteCond%{} SERVER_PORT 80

的RewriteCond%{REQUEST_URI}博客

重写规则^(。*)$ http://www.newside.com/newblog/ $ 1 [R,L]

I have gone through several domain iterations on a wordpress blog and want to get old links redirected to the new domain. Initially the blog was in

olddomain.com/blog/

Now the blog is at the root level of

 newdomain.com

The old domain is set up as a domain alias of the new domain, it is not forwarded.

If anyone visits the site from

 olddomain.com/blog/

I need that to redirect to

 newdomain.com/

Thanks for your help.

解决方案

Just create your .htaccess file and put it in the folder where you want to redirect from e.g put it in the /blog folder.

Add the following lines to your .htaccess file.

RewriteEngine On

RewriteCond %{SERVER_PORT} 80

RewriteCond %{REQUEST_URI} blog

RewriteRule ^(.*)$ http://www.newside.com/newblog/$1 [R,L]