Forums

WP-Super Cache: Not ignoring URLs with GET parameters (10 posts)

  1. AlanWhipple
    Member
    Posted 4 years ago #

    WP-Super Cache doesn't seem to be ignoring URLs with GET parameters like it says it does. As a result, the majority of my pages are displayed AS the index page. Even the RSS feeds load as the index.html file with super cache enabled.

    It should be noted that I do NOT have fancy permalinks enabled.

    I assume the expected functionality would be to ONLY use the super cache feature when loading the main index page. Instead it is loading the HTML file regardless of what parameters it has. For example:
    /?feed=rss2
    /?p=100

    Right now I just have WP Cache (that came with super cache) enabled, and the super cache feature disabled. However, I wanted to leverage it's superior caching.
    Any advice?

  2. Otto
    Tech Ninja
    Posted 4 years ago #

    WP-Super-Cache is not compatible with default permalinks. You have to use one of the "pretty" permalinks options with it.

  3. AlanWhipple
    Member
    Posted 4 years ago #

    Ok, so I tried turning on the "numeric" permalinks and WP Super Cache worked a bit better.

    HOWEVER, this doesn't change anything concerning the RSS feeds. /?feed=rss2 is not overwritten by anything, and thus is still an issue when using WP Super Cache.

    I am guessing that an extra rewrite rule in the .htaccess file would do the trick, but the mod_rewrite code is very foreign to me, so if anyone has a suggestion, let me know.

    I know that the feed can be accessed from:
    /wp-rss2.php or
    /wp-feed.php

    What is the difference from using the URL parameter??? Such as /?feed=rss2

    If there is NO difference then I imagine someone would tell me to hardcode any instance of the RSS feed directly to the respective PHP file.

    If there is an ideal solution I would be happy to hear it.

    Suggestions?

  4. Otto
    Tech Ninja
    Posted 4 years ago #

    If you have pretty permalinks on, the correct feed link is simply /feed/ . Other links can be /feed/rss2/ or /feed/atom/ and such, but these are the only correct links.

    wp-rss2.php and similar are deprecated and should not be used. WordPress will never generate those links itself, they're only there for backward compatibility.

    The correct feed link can be output at any time by:
    <?php bloginfo('rss2_url'); ?>

  5. AlanWhipple
    Member
    Posted 4 years ago #

    Thank you Otto42, you have been helping me understand a little better. However there is still one somewhat important issue on this topic.

    As I mentioned, the blog was previously using the default "Ugly" permalinks. I switched it to the most similar pretty permalinks, Numeric.

    Wp-super-cache seems to be working with such URLs. However, this is a pretty popular blog, and there are probably links around the net pointing to specific posts in the ugly format: /?p=123

    If a user navigates to this link, Super Cache serves the cached index page. Without Super Cache, WordPress itself understands this syntax and seems to rewrite it to the proper address. With Super Cache enabled, it just serves the main index page.

    Is there some extra rewrite code that I need? Or am I out of luck because I didn't start with the pretty links?

  6. Donncha O Caoimh
    Member
    Posted 4 years ago #

    AlanWhipple - look in your .htaccess. You'll see a line with .*s=.* in it. Copy that line and in the new line replace s with p. That should stop those urls getting served as the main page, but by the same token, they won't be cached either. You should redirect to the proper URL so that is cached!

  7. AlanWhipple
    Member
    Posted 4 years ago #

    donncha - I tried out your recommendation. There are actually two places where there is a line with .*s=.* in it, one for gzip and one without gzip. I made identical lines underneath both for "p" as well as "feed". This DID result in the pages not being served as the main page. However, as you said, they don't seem to be cached. Well... let me elaborate on what I see.

    Now that I have pretty permalinks enabled, I have been testing the old structure of links. WordPress is always redirecting any request to the old structure to the new structure. This redirecting fails to occur when Super Cache is enabled - that is the root of this problem. I wish I knew how to force this redirection. If anyone has code to do this, please let me know.

    In addition, I have another problem which may or may not be related. When I have Super Cache enabled, it stores files into that 'supercache' directory. However, if I navigate (in a browser) to a page other then the main page (like a single post page) and refresh it many times, it still doesn't seem to be served by Super Cache. The only way I have been checking is by viewing the source code and looking for the "super cache" comment at the bottom. Is that the best way? If this method is a clear indicator of a page served by super cache, then it is not working for me when it should. However, the HTML file seems to be saved on the server when I check the FTP.

    At first I thought this had to do with the "p" line I added to the .htaccess file. But then I removed it and the results are the same. I couldn't get a page other than the main index page to say it was served by super cache. And that was using the pretty links of course.

    Not sure if those problems are related but it was worth mentioning.

    So, does anyone (especially donncha) have an answer to the redirecting issue? Thanks.

  8. Donncha O Caoimh
    Member
    Posted 4 years ago #

    When you tested if pages were super cached, were you logged in?

  9. AlanWhipple
    Member
    Posted 4 years ago #

    No. I used 2 different browsers where I was not logged in. Clean session, just refreshing pages and viewing source.

  10. Donncha O Caoimh
    Member
    Posted 4 years ago #

    Strange. What's your URL? I'd like to give it a go too.

Topic Closed

This topic has been closed to new replies.

About this Topic