doudou0111 2017-10-24 20:58 采纳率: 0%
浏览 64

提供静态内容 - Wordpress无Cookie子域

I've followed this guide to the brim, but on step 3 I'm being stumped.

I've declared the following in the wp-config.php (customized to my domain):

define("WP_CONTENT_URL", "http://static.domainname.com");
define("COOKIE_DOMAIN", "www.domainname.com");
define("WP_PLUGIN_URL", "http://static.domainname.com/plugins");

And I've gone in phpMyAdmin in cPanel and done this update:

UPDATE wp_posts SET post_content = REPLACE(post_content,
 'http://www.domainname.com/wp-content/uploads/','http://static.domainname.com/uploads/')

However, I get this result:

0 rows affected phpMyAdmin

When I update new content, the images get prepended "static," which is good, but my stylesheets also have "static," and since there's no content loaded on that subdomain, my site gets wrecked. And all existing images need to be uploaded to the subdomain so they are also served via "static."

Am I following the guide above wrongly?

  • 写回答

1条回答 默认 最新

  • dtkwt62022 2018-01-09 15:59
    关注

    If you've stumbled upon this, I forgot to keep

    SELECT * FROM `wp_posts` 
    

    above the update posts.

    In final, the phpMyAdmin would look like:

    SELECT * FROM `wp_posts`;
    UPDATE wp_posts SET post_content = REPLACE(post_content,
     'http://www.domainname.com/wp-content/uploads/','http://static.domainname.com/')
    
    评论

报告相同问题?