.htaccess将文件夹下的所有页面重定向到新域

问题描述:

我有一些文件放在旧域中的特定文件夹下,如下所示:
http://www.olddomain。 com / folder1 /

I have some files placed under a particular folder in my old domain like this: http://www.olddomain.com/folder1/.

我想将尝试访问此文件夹下的文件的所有请求重定向到新域。
示例:
http://www.olddomain.com/folder1/page1.html - > http://www.newdomain.com/page1.html

I want to redirect all requests that try to access files under this folder to a new domain. Example: http://www.olddomain.com/folder1/page1.html -> http://www.newdomain.com/page1.html

如何使用.htaccess完成此操作?

How do I accomplish this using .htaccess?

给这一点。

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

RewriteRule ^folder1(.*)$ http://www.newdomain.com/$1 [L,R=301]

</IfModule>