WordPress.org

Ready to get started?Download WordPress

Forums

WordPress SEO by Yoast
[resolved] [Plugin: WordPress SEO] Doesn't play well with WP_CONTENT_URL (29 posts)

  1. staze
    Member
    Posted 3 years ago #

    I have wp_content_url set for serving static content. This seems to break the ability to manually force a refresh of the sitemap, since it thinks the URL is for static content.

    Also, and I can create another thread for this, but supporting a .gz version of the sitemap would be good.

  2. Carlos Correza
    Member
    Posted 3 years ago #

    the plugin does output a gz version of the sitemap.

    its located at:

    http://yoursite.com/sitemap.xml.gz

  3. Joost de Valk
    Member
    Plugin Author

    Posted 3 years ago #

    Hey Staze, 0.1.4 should have fixed this for you, right?

  4. staze
    Member
    Posted 3 years ago #

    nope, still broken. =(

    "Rebuild XML sitemap" does nothing (nothing happens when clicking the button). And it points to "javascript:rebuildSitemap('https://static.staze.org/wp-contents/plugins/wordpress-seo/',")"; I'm not sure, but this should probably point to something more like https://www.staze.org/wp-contents/plugins/wordpress-seo.

    There is no sitemap to be found at /sitemap.xml. =/

  5. staze
    Member
    Posted 3 years ago #

    As a note, wordpress-seo never prompted to update from 0.1.3 to 0.1.4. I had to download the new plugin, and move it onto the site. Just to make sure things went right, as well, I disabled and reenabled the plugin to make sure something wasn't wedged.

  6. Joost de Valk
    Member
    Plugin Author

    Posted 3 years ago #

    How does your config work? The plugin uses WP_PLUGIN_URL, which you should probably also define if you're changing WP_CONTENT_URL, as it's based off of that. If you'd define WP_PLUGIN_URL as http://www.staze.org/wp-content/plugins it would work correctly.

  7. staze
    Member
    Posted 3 years ago #

    ah ha, okay. I defined that and now the regen acts like it's working, and says it worked, but there is no sitemap at /sitemap.xml.

    Looks like it put it in /wp-content/uploads/wpseo/sitemap.xml?

    which makes me think either there's a rewrite rule that isn't getting written to .htaccess...

  8. Joost de Valk
    Member
    Plugin Author

    Posted 3 years ago #

    That's an actual issue on my side, fixed in 0.1.5, which is coming in a couple of minutes :)

  9. staze
    Member
    Posted 3 years ago #

    ah, cool.

    I wait with baited breath. =) btw, will you be enabling updates from wp.org with this release?

    Thanks for the heads up on wp_plugin_url... as it doesn't seem to be documented really anywhere, I had no idea it was actually available. It fixed another issue I was having that was purely cosmetic, but still annoying.

  10. Joost de Valk
    Member
    Plugin Author

    Posted 3 years ago #

    If all goes well this should indeed update properly.

  11. staze
    Member
    Posted 3 years ago #

    almost there...

    So now the issue is, it writes the sitemap out with the xsl url https:// rather than http://...

    So if the sitemap is accessed via http, the browser chokes because the xsl is over https... but accessing the sitemap via https works.

    any thoughts?

    and yes, I have FORCE_SSL_ADMIN set to "true".

  12. Joost de Valk
    Member
    Plugin Author

    Posted 3 years ago #

    Did you regenerate? That uses the same function, so if you set WP_PLUGIN_URL correctly, without the https, it should work.

  13. staze
    Member
    Posted 3 years ago #

    I did. And to be double sure, I just removed the existing sitemap, and regenerated again. Same result.

    It appears that wordpress is doing a replace of all http:// with https:// in config options when force_ssl_admin is set, so that things work when logged into the wp-admin site (and don't generate a bunch of errors about some content being insecure).

    might it be better to just regrab that value from wp-config.php when generating the sitemap, to avoid this? I'm not sure how Google XML Sitemap does it, but it does not have the same issue. =/

    Thankfully, the sitemap is visible to google, so it's really only an issue if I try to look at it from a web browser (or something that actually uses the xsl file).

  14. staze
    Member
    Posted 3 years ago #

    actually, seems that google thinks the sitemap is "images" and has WAY too many submitted URLs. Wonder if this could be due to this issue...

    Switched back to Google XML Sitemaps for now...

  15. Joost de Valk
    Member
    Plugin Author

    Posted 3 years ago #

    Hey staze, fixed the https issue for the xsl file.

    The sitemap type is "images" because it's a mixed sitemap and Google isn't displaying that any better at the moment, unfortunately, both images and url's are still crawled though.

  16. staze
    Member
    Posted 3 years ago #

    Sweet, this does indeed seem to fix it. Thanks!

  17. staze
    Member
    Posted 3 years ago #

    Correction, it does not fix the problem, it just changed it. I hadn't removed the sitemap created by "Google XML Sitemap" before testing now that I have, it's still not working right.

    Now I get "Error loading stylesheet: A network error occured loading an XSLT stylesheet:http://www.staze.org/css/xml-sitemap.xsl" (which makes sense, since the xsl exists within the wordpress-seo css directory.

    Since this should be something more like:

    http://www.staze.org/wp-content/plugins/wordpress-seo/css/xml-sitemap.xsl"

    I just edited the sitemap myself and this does indeed allow the XSL to load.

    I doubt it's the fact I don't have WP_PLUGIN_DIR set since if that was the case, I'd think it would be something like http://www.staze.org/wordpress-seo/css/xml-sitemap.xml

    Any thoughts?

  18. Joost de Valk
    Member
    Plugin Author

    Posted 3 years ago #

    This is the code used to generate the URL for the XSL:

    $pluginurl = plugin_dir_url(__FILE__);
    if ( preg_match( '/^https/', $pluginurl ) && !preg_match( '/^https/', get_bloginfo('url') ) )
    	$pluginurl = preg_replace( '/^https', '/^http', $pluginurl );
    define( 'WPSEO_FRONT_URL', $pluginurl );

    It generates the plugin URL, then checks if plugin URL has https and whether site url does NOT have https, and if so replaces https with http... What could go wrong here unless a wrong setup on your side? :)

  19. staze
    Member
    Posted 3 years ago #

    So, something is wrong with that preg_replace code, as I'm seeing "preg_replace(): No ending delimiter '/' found in...".

    I'm fiddling with it myself, but my regex-fu sucks.

  20. staze
    Member
    Posted 3 years ago #

    This works...

    preg_replace( '/^https/', 'http', $pluginurl );

  21. Joost de Valk
    Member
    Plugin Author

    Posted 3 years ago #

    You're 100% right. Fixing.

  22. staze
    Member
    Posted 3 years ago #

    hooray! =)

    Thanks! Always great to work with a dev that actually responds to issues. =)

  23. Joost de Valk
    Member
    Plugin Author

    Posted 3 years ago #

    Ok it's in 0.1.8, which I'm submitting to wordpress.org NOW :)

  24. staze
    Member
    Posted 3 years ago #

    lol! You fixed the preg_match, but not the preg_replace...

    The block should look like:

    $pluginurl = plugin_dir_url(__FILE__);
    if ( preg_match( '/^https/', $pluginurl ) && !preg_match( '/^https/', get_bloginfo('url') ) )
    	$pluginurl = preg_replace( '/^https/', 'http', $pluginurl );
    define( 'WPSEO_FRONT_URL', $pluginurl );

    (sorry I keep giving you work. =P)

  25. Joost de Valk
    Member
    Plugin Author

    Posted 3 years ago #

    Will be fixed in 0.1.9 :P

  26. staze
    Member
    Posted 3 years ago #

    still broken in 0.2.0.

  27. Joost de Valk
    Member
    Plugin Author

    Posted 3 years ago #

    Helps if i actually add the / in the 3rd line eh? :) Fixed now... You'll have to wait another version, sorry.

  28. staze
    Member
    Posted 3 years ago #

    heh. no problem. it's easy enough to fix it myself for now.

    Thanks!

  29. staze
    Member
    Posted 3 years ago #

    it works! setting to resolved. Thanks!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic