• Resolved byronyasgur

    (@byronyasgur)


    First of all thanks for the amazing plugin. I use it on all my sites for years and it’s bulletproof. I took a minute to give you a 5 star review just now.

    I’m rebuilding a site for a client ( switching to a different theme ) and we have the new version of the site set up in a development directory ( eg https://domain.com/development ) and we’re running the development with your plugin active and maintenance mode active – as we regularly do … but for some reason on this site when a link has the www in front of it it’s not recognising us as admins and thus letting us have access to the site … so for example

    domain.com/the-page-slug is blocked to non logged in and open to admins working on the development ( as you’d expect )

    BUT

    https://www.domain.com/the-page-slug is blocked to admins too

    so we have to manually delete the www. from any page in order to see it … we didn’t develop the original site and most of the links point to www versions of the pages and it’s a large site so it’s a major PITA. I thought about trying some htaccess whackery but I thought I should ask here instead.

    thanks
    Bob

Viewing 9 replies - 1 through 9 (of 9 total)
  • Hello @byronyasgur,

    With Maintenance Mode deactivated… you’re recognized as a logged-in user on the www version?

    Thanks.

    • This reply was modified 7 years, 3 months ago by George J.
    Thread Starter byronyasgur

    (@byronyasgur)

    Not sure how I’d ascertain this. I tried deactivating the plugin and browsing to the WWW version of the site and seeing if the WordPress toolbar showed but it redirected me back to the non WWW so it showed anyway

    Edit – to be honest though I tried the same thing on a few of my other sites and they all boot me back to the non www version – so yea how would I figure out the answer to your question if it does that

    • This reply was modified 7 years, 3 months ago by byronyasgur.
    Thread Starter byronyasgur

    (@byronyasgur)

    Your comment got me thinking and I noticed a few things …

    I’m starting to wonder whether it’s more of a conflict between the way the site was originally built and the way we’re doing the redevelopment.

    We’re using https://domain.com for the redevelopment ( Settings>General>URLs ) but all the links in the content which we’ve imported in – as we weren’t able to do a direct clone of the site – are based on the old WWW structure.

    WP has a redirect built in based so all this is probably confusing to your plugin or something.

    At this point I’m thinking it might cause other problems too so I think I’ll just use Velvet Blues to rename everything to non wwww and cover any SEO fallout in my 301 file.

    Anyway I’m not sure what you think – whether you think it’s an issue with your plugin or some weirdness caused by what I’ve described above.

    @byronyasgur a fast solution would be make a small change in one of the plugin’s files.

    wp-maintenance-mode/includes/classes/wp-maintenance-mode.php

    
    // search & change next line:
    add_action('init', array($this, 'init'));
    
    // with this line:
    add_action('template_redirect', array($this, 'init'));
    

    For now it is the only idea, but I have to do more tests and maybe release a patch if needed.

    • This reply was modified 7 years, 3 months ago by George J.
    • This reply was modified 7 years, 3 months ago by George J.
    Thread Starter byronyasgur

    (@byronyasgur)

    Yea that worked perfectly – thanks. I’ll probably address the issue on the site too TBH because I don’t know that it’s very good to have the pages in non-www and the links in www like the way I discovered I actually have it.

    Thanks for your help.

    @byronyasgur: you’re welcome.

    Just a small update.

    
    // this line:
    add_action('template_redirect', array($this, 'init'));
    
    
    // should be:
    add_action((is_admin() ? 'init' : 'template_redirect'), array($this, 'init'));
    

    Also, for development purposes I would use subdomains like: https://dev.domain.com/ ??

    • This reply was modified 7 years, 3 months ago by George J.
    Thread Starter byronyasgur

    (@byronyasgur)

    I’ll put that in – thanks

    why the subdomain rather than the directory?

    @byronyasgur because I like to keep separated the environments (production, staging, development).

    Also…
    – you can put the subdomain on a different server if needed
    – you can set a different version of PHP, to test it before you deploy the code in production
    – you can set different settings for Apache/Nginx, PHP, etc.

    Thread Starter byronyasgur

    (@byronyasgur)

    – ok cool – never really need to do any of that myself but it all makes sense – prob better practice – thanks

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘www versions of pages locking admins out’ is closed to new replies.