重定向库文件夹移动到另一个域中的画廊 [英] Redirect gallery folder to a gallery in another domain

查看:116
本文介绍了重定向库文件夹移动到另一个域中的画廊的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我安装了一个字preSS博客与NextGen的画廊,我想重定向所有的画廊图像请求到另一个domain.I有重复的站点1的所有图像,以SITE2文件夹。

http://site1.com/wp-content/uploads/gallery/folder/*.jpg http://site2.com/gallery/folder/*.jpg

请帮我的.htaccess重定向规则

解决方案
  

我安装了一个字preSS博客与NextGen的画廊,我想   重定向所有的画廊图像请求到另一个domain.I已   复制所有的图像从站点1到站点2文件夹。

您必须确保自定义规则没有得到冲突WP自己的规则集。

假设它是标准之一,在根目录中选择一个.htaccess文件,用下面替换:

 #BEGIN字preSS
< IfModule mod_rewrite.c>
RewriteEngine叙述上
的RewriteBase /
重写规则^指数\ .PHP $  -  [L]

#加入这行
的RewriteCond%{REQUEST_URI}!的wp-content /上传/库/文件夹[NC]

的RewriteCond%{} REQUEST_FILENAME!-f
的RewriteCond%{} REQUEST_FILENAME!-d
重写规则。的index.php [L]

#加入这行
重写规则^的wp-content /上传/库/文件夹/([^。] +)\。JPG http://site2.com/gallery/folder/$1.jpg [R = 301,L,NC]

< / IfModule>
#结束字preSS
 

选项:

有关的任​​何文件类型,请用这一个最后的规则:

 #加入这行
重写规则^的wp-content /上传/库/文件夹/([^.]+)\.([^/]+)/? http://site2.com/gallery/folder/$1.$2 [R = 301,L,NC]
 

I have a wordpress blog with Nextgen gallery installed, I want to redirect all the gallery image request to another domain.I have duplicated all the images from site1 to site2 folder.

http://site1.com/wp-content/uploads/gallery/folder/*.jpg to http://site2.com/gallery/folder/*.jpg

please help me with the .htaccess redirect rules

解决方案

I have a wordpress blog with Nextgen gallery installed, I want to redirect all the gallery image request to another domain.I have duplicated all the images from site1 to site2 folder.

You have to make sure the custom rules don't get in conflict with WP own rule-set.

Assuming it is the standard one in one .htaccess file at root directory, replace it with the following one:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# Add this line
RewriteCond %{REQUEST_URI} !wp-content/uploads/gallery/folder  [NC]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# Add this line
RewriteRule ^wp-content/uploads/gallery/folder/([^.]+)\.jpg   http://site2.com/gallery/folder/$1.jpg [R=301,L,NC]

</IfModule>
# END WordPress

Option:

For any file type, replace the last rule with this one:

# Add this line
RewriteRule ^wp-content/uploads/gallery/folder/([^.]+)\.([^/]+)/?   http://site2.com/gallery/folder/$1.$2 [R=301,L,NC]

这篇关于重定向库文件夹移动到另一个域中的画廊的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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