admin管理员组文章数量:1414614
I developed a site locally with /%postname%/
permalink structure. I did some sample posts locally and wanted to move this entire local setup to a temporary subdomain like .
1.) I exported the local sql table and imported it on the real database
2.) I changed the two fields inside the wp-options
table to fit the new url
3.) I uploaded all files to the real server and got rid of the "wp-config.php" and installed wordpress on the real server.
4.) If I launch I see the site running and everything seems to work just fine. The stylesheets, the js, everything.
However only thing that does not work are my permalinks! Every link ends in a 404 -> e.g.
I also copied the .htaccess file from my local server to the real one. I even tried dropping the entire "permalinks" field in the wp-options table and reset the permalink-structure in the permalink settings inside wp.
Any ideas on that matter?
I developed a site locally with /%postname%/
permalink structure. I did some sample posts locally and wanted to move this entire local setup to a temporary subdomain like http://review.clientsite.
1.) I exported the local sql table and imported it on the real database
2.) I changed the two fields inside the wp-options
table to fit the new url http://review.clientside
3.) I uploaded all files to the real server and got rid of the "wp-config.php" and installed wordpress on the real server.
4.) If I launch http://review.clientside I see the site running and everything seems to work just fine. The stylesheets, the js, everything.
However only thing that does not work are my permalinks! Every link ends in a 404 -> e.g. http://review.clientside/projects
I also copied the .htaccess file from my local server to the real one. I even tried dropping the entire "permalinks" field in the wp-options table and reset the permalink-structure in the permalink settings inside wp.
Any ideas on that matter?
Share Improve this question asked Aug 14, 2012 at 15:34 mathiregistermathiregister 1,54313 gold badges55 silver badges78 bronze badges2 Answers
Reset to default 1You have to change other URLs in the database, not just in the wp_options tables. Use these queries in phpmyadmin to change post links and metadata within post and page content:
UPDATE wp_posts SET guid = replace(guid, 'http://www.olddomain/','http://www.newdomain/');
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.olddomain/', 'http://www.newdomain/');
UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://www.olddomain/', 'http://www.newdomain/');
Reset permalinks again after those changes. And also use the full search in phpmyadmin to check if your old domain is anywhere else, such as in widget or plugin data.
My checklist for such cases is as follow:
- .htaccess, did I plug it in the prod website?
- Did I scrub the database properly?
As a last resort, can I modify it in wp-config.php?
-- htaccess -- One thing that is important to consider is the existance of a .htaccess file. It seems to be the most common issue.
-- DB Scrub -- When migrating data local->development->staging, I personally use the following tool to "scrub" the database. Interconnect/IT (https://interconnectit/products/search-and-replace-for-wordpress-databases/) -- Not paid, just awesome for DB scrubbing.
wp-config.php -- Alternatively, you can do the following in your wp-config.php file:
!defined('WP_SITEURL') && define('WP_SITEURL', 'http://review.clientside');
!defined('WP_HOME') && define('WP_HOME', "http://review.clientside");
In all cases, make sure to reset permalinks from WP admin, after you complete the setup.
本文标签: 404 errorMoving local wordpress page to a real server subdomain broke my permalinks
版权声明:本文标题:404 error - Moving local wordpress page to a real server subdomain broke my permalinks? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745163255a2645550.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论