wordpress如何更换域名
在phpmyadmin中执行下面的查询语句
UPDATE wp_options SET option_value = replace(option_value,'http://kimozh.net','http://www.vkilo.com') WHERE option_name = 'home' OR option_name = 'siteurl'; UPDATE wp_posts SET post_content = replace(post_content,'http://kimozh.net','http://www.vkilo.com'); UPDATE wp_posts SET guid = replace(guid,'http://kimozh.net','http://www.vkilo.com');
domain格式 http://www.vkilo.com 最后不要带"/";
如果出错,检查是不是标点符号有问题!
wordpress换域名完美301重定向
假如你的linux主机只需要把 .htaccess 文件 WordPress 部分修改成下面样子:
# BEGIN WordPress <IfModule mod_rewrite.c> Options +FollowSymLinks RewriteEngine on rewritecond %{http_host} ^www.old.com [nc] rewriterule ^(.*)$ http://www.new.com/$1 [L,R=301] </IfModule> # END WordPress
if (strtolower($_SERVER['SERVER_NAME'])!='www.kimozh.net') { $URIRedirect=$_SERVER['REQUEST_URI']; if(strtolower($URIRedirect)=="/index.php") { $URIRedirect="/"; } header('HTTP/1.1 301 Moved Permanently'); header('Location:http://www.vkilo.com'.$URIRedirect); exit(); }