Products
GG网络技术分享 2025-03-18 16:12 3
Noticed that by default wordpress keeps the site name www.mysite.com/wordpress but we wanted to change it to www.mysite.com/blog. Based on the documentation and other stackoverflow posts, it\'s as simple as making following changes.
Or manually update wp_options table if you are unable to get into WP admin console.
Also followed all the steps mentioned here but still no luck, getting 404 errors when going to the new URL.
图片转代码服务由CSDN问答提供
感谢您的意见,我们尽快改进~
功能建议注意到默认情况下wordpress保留网站名称www.mysite.com/wordpress但我们想将其更改为www .mysite.com /博客。 根据文档和其他stackoverflow帖子,它就像进行以下更改一样简单。</ p>
< li>修复.htaccess条目以获得正确的重写规则</ li>
</ ol>
如果您不能,请手动更新wp_options表 进入WP管理控制台。</ p>
还按照提到的所有步骤进行操作这里但仍然没有运气,在转到新网址时收到404错误。</ p>
</ div>
For some reason none of the approaches including what Hugo mentioned above didn\'t work for me. I then renamed the root WP installation directory from \'wordpress\' to \'blog\' to math the URL and everything is working now.
I am not sure why I had to do this but it seems to be working fine now.
###
Wordpress keep URL information in database.
You need to update them as well.
Perform search and replace into your DB to replace your existing URL with the new one :UPDATE wp_options SET option_value = replace(option_value, \'Existing URL\', \'New URL\') WHERE option_name = \'home\' OR option_name = \'siteurl\';UPDATE wp_posts SET post_content = replace(post_content, \'Existing URL\', \'New URL\');
UPDATE wp_postmeta SET meta_value = replace(meta_value,\'Existing URL\',\'New URL\');
UPDATE wp_usermeta SET meta_value = replace(meta_value, \'Existing URL\',\'New URL\');
UPDATE wp_links SET link_url = replace(link_url, \'Existing URL\',\'New URL\');
UPDATE wp_comments SET comment_content = replace(comment_content , \'Existing URL\',\'New URL\');
NB : wp_ change it to your wordpress installation prefix
You can also use this to go faster : https://rudrastyh.com/tools/sql-queries-generator. There is also some WP Plugins to perform search and replace within your WP DB.
Demand feedback