htaccess将所有文件从一个域中的子目录重定向到另一个域 [英] Htaccess redirect all files from subdirectory in one domain to another domain
本文介绍了htaccess将所有文件从一个域中的子目录重定向到另一个域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试从一个域中一个目录中的所有文件创建永久的htaccess重定向(301),如下所示:
I am trying to create a permanent htaccess redirect (301) from all files in one directory in one domain, to another domain as follows:
将其中的所有文件重定向以下目录:
Redirect all files in the following directory:
http://www.primary.com/apples/*
收件人:
http://www.secondary.com
我对htaccess的经验不是很丰富,并且想知道是否有人可以帮助我创建此重定向?
I am not very experienced with htaccess and was wondering if someone can assist me in creating this redirect?
非常感谢!
推荐答案
这应该合而为一.htaccess文件位于 primary.com
根目录:
This should work in one .htaccess file at primary.com
root directory:
Options +FollowSymlinks -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.primary\.com [NC]
RewriteRule ^apples/(.*) http://www.secondary.com/$1 [R=301,NC,L]
这篇关于htaccess将所有文件从一个域中的子目录重定向到另一个域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文