简体   繁体   中英

Changing URL in Wordpress : Absolute links

I'm currently changing the URL of a Wordpress website, and I've got problems with it...
First of all, let's write versions of what I'm using

  • Wordpress: 4.5.3
  • MySQL: 5.5
  • PHP: 5.6

The website is hosted at www.xxx.com/blog/ and when I access this URL, everything is working as expected, but I want to change this URL to www.yyy.com/

So I paid a domain name www.yyy.com/ (with http://godaddy.com ) and I made a forward with masking from yyy.com to xxx.com/blog

So now, when I access www.yyy.com/ , I access the home page of the website, and the URL is www.yyy.com but here start to be the problem...

Only the home page is working, all the links to the posts are dead... So I made a search and replace in the database, and I change all the link www.xxx.com/blog/2016/zzz to www.yyy.com/2016/zzz and when I access them directly by URL it's working, but when I access them by clicking on the website, the link is www.xxx.com/blog/2016/zzz and the URL is staying www.yyy.com (not keeping trace of /2016/zzz ...)

So I then find out that there are 2 variables in the database:

  • siteurl = www.xxx.com/blog/
  • home = www.xxx.com/blog/

and if I change just one of these 2 variables to www.yyy.com/ the website dies, I get a blank page and nothing is not working anymore...

So currently, I've got:

  • A domain name yyy.com which make a forward with masking to xxx.com/blog/
  • All the link the posts are www.yyy.com/2016/zzz in the database.
  • Access the URL www.yyy.com/2016/zzz directly is working.
  • Access the URL www.yyy.com/ directly is working.
  • siteurl = www.xxx.com/blog/
  • home = www.xxx.com/blog/

Problems that need to be fixed:

  • Links on the website are still www.xxx.com/blog/2016/zzz
  • siteurl and home are the old URL but if I change them, I've got a blank page.

I hope anyone had already this issue and will be able to help me :)


EDIT

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

# END WordPress

Best Regards,

当您使用www.yyy.com时,在.htaccess文件中将rewritebase更改为/而不是/blog/ ,然后将siteurl和home更改为www.yyy.com

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM