将访问者重定向到新网址,但不包含图片和管理员 [英] Redirect Visitors to new url but exclude images and admin
本文介绍了将访问者重定向到新网址,但不包含图片和管理员的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用自托管的wordpress,希望将访问者从fashionbeautyetc.com重定向到fayekent.co.uk上的相应页面/帖子。我希望排除重定向应用于图像和WP仪表板(wp-admin)我应该在htaccess中放置什么代码
I use self hosted wordpress and wish to redirect visitors from fashionbeautyetc.com to corresponding page/post on fayekent.co.uk. I wish to exclude the redirect being applied to images and the WP dashboard (wp-admin) what code should I place in htaccess
已经存在的代码如下:
SuPHP_ConfigPath /var/sites/f/fashionbeautyetc.com/public_html
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
推荐答案
在#BEGIN WordPress
之前添加此内容:
RewriteCond %{HTTP_HOST} ^(www\.)?fashionbeautyetc\.com$ [NC]
RewriteCond %{REQUEST_URI} !\.(jpe?g|png|gif|ico)$ [NC]
RewriteCond %{REQUEST_URI} !wp-admin
RewriteRule ^(.*)$ http://fayekent.co.uk/$1 [L,R=301]
这篇关于将访问者重定向到新网址,但不包含图片和管理员的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文