本文介绍了阿帕奇的.htaccess URL重写的Word preSS - 永远指向一个域到另一个的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想指出www.olddomain.com/whatever到www.newdomain.com/whatever(以及不包含www。),但这个词preSS固定链接不能呆在完好无损。请帮助!

 < IfModule mod_rewrite.c>
RewriteEngine叙述上

的RewriteBase /

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

的RewriteCond%{HTTP_HOST} ^ olddomain.com [NC]
重写规则^(。*)$ http://www.newdomain.com/$1 [R = 301,NC]

的RewriteCond%{HTTP_HOST} ^ www.olddomain.com [NC]
重写规则^(。*)$ http://www.newdomain.com/$1 [R = 301,NC]

< / IfModule>
 

解决方案

一个更简单的解决方案。更改的.htaccess只​​是说:

  RedirectMatch 301 /(.*)http://www.newdomain.com/$1
 

I am trying to point www.olddomain.com/whatever to www.newdomain.com/whatever (as well as without the www.), but the Wordpress permalinks are not staying intact. Please help!!

<IfModule mod_rewrite.c>
RewriteEngine On

RewriteBase /

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

RewriteCond %{HTTP_HOST} ^olddomain.com [nc]
RewriteRule ^(.*)$ http://www.newdomain.com/$1 [r=301,nc]

RewriteCond %{HTTP_HOST} ^www.olddomain.com [nc]
RewriteRule ^(.*)$ http://www.newdomain.com/$1 [r=301,nc]

</IfModule>
解决方案

A much simpler solution. Change the .htaccess to just say:

RedirectMatch 301 /(.*) http://www.newdomain.com/$1

这篇关于阿帕奇的.htaccess URL重写的Word preSS - 永远指向一个域到另一个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 14:16