WordPress自定义结构永久链接中断

WordPress自定义结构永久链接中断

本文介绍了将站点迁移到新域和服务器后,WordPress自定义结构永久链接中断的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在网站 mysite1.com 上安装了我的WP,并将其迁移到 mysite2.com ,托管于不同的服务器。我在数据库中运行了一个find-and-replace, mysite1.com - > mysite2.com 主页mysite2.com现在正常运行但所有子页面( mysite2.com/subpage1 mysite2.com/subpage2 mysite2.com/subpage1/thing?id=1 等)不要工作。我正在使用自定义结构 http://mysite2.com/%postname%/ ,它在 mysite1.com上工作得很好所有其他永久链接结构都适用于 mysite2.com ,我可能会补充说。当我切换回子页面404的自定义结构时。

I had my WP on a site mysite1.com and am migrating it to mysite2.com, hosted on a different server. I simple ran a find-and-replace in the database, mysite1.com -> mysite2.com, and the homepage mysite2.com now works fine but all the subpages (mysite2.com/subpage1, mysite2.com/subpage2, mysite2.com/subpage1/thing?id=1, etc.) do not work. I'm using the Custom Structure http://mysite2.com/%postname%/, which worked just fine on mysite1.com. All the other Permalink structures work on mysite2.com, I might add. It's when I switch back to the custom structure that the subpages 404.

这可能与需要配置我的新服务器或 php有关.ini 或其他什么?

Could this have something to do with needing to configure my new server or php.ini or anything?

关于问题可能原因以及我可以做些什么来修复它的任何想法?

Any ideas on what may be the cause of the problem and what I can do to fix it?

推荐答案

尝试将.htaccess文件放在wordpress的根目录上。然后将其权限更改为755并将永久链接结构更改为postname。

Just try putting an .htaccess file on the root of your wordpress. Then change its permission to 755 and the change the permalink structure to postname.

以下是示例.htacess文件代码。

Here is sample .htacess file code.

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /mysite2.com/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /mysite2.com/index.php [L]
</IfModule>

# END WordPress

这篇关于将站点迁移到新域和服务器后,WordPress自定义结构永久链接中断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 16:18