2012-10-06 253 views
0

我有一个wordpress博客运行example1.com/folder或www.example1.com/folder。现在我必须将其重定向到example2.com或www.example2.com。我如何使用.htaccess来做到这一点?域子文件夹重定向到域使用.htaccess在wordpress

+0

我在我的.htaccess文件下面的代码: #BEGIN WordPress RewriteEngine On RewriteBase/ RewriteRule^index \ .php $ - [L] RewriteCond%{REQUEST_FILENAME}!-f RewriteCond%{REQUEST_FILENAME}!-d RewriteRule。 /index.php [L] #结束WordPress – uvishere

回答

0
RewriteEngine On 

RewriteCond %{HTTP_HOST} ^((www.)?)example1.com [NC] 
RewriteRule ^folder/(.*)$ http://www.example2.com/$1 [R=301,L] 

如果它收到的流量www.example1.comexample.com如果有任何发送去/folder/.*www.example2.com/.*例如该检查:

www.example1.com/folder/blah.html成为www.example2.com/blah.html

+0

我很抱歉,但重定向无法正常工作。我想将www.greatwayonine.com/np或greatwayonine.com后面的任何文件夹重定向到www.onlinegreatway.com。但页面未找到错误仍然存​​在。任何解决方案@Peter? – uvishere

+0

'RewriteCond%{HTTP_HOST} ^((www。)?)greatwayonine.com [NC]' 'RewriteRule ^(。*)$ http://www.onlinegreatway.com/$1 [R = 301,L]' 假设存在相同的文件夹结构,即onlinegreatway.com/np也存在。 – Peter

相关问题