ryan Posted November 5, 2011 Share Posted November 5, 2011 The default header code for redirects in PW is a 302 redirect (page has temporarily moved) which is actually the default code for a redirect in PHP itself. Just wanted to mention that the default for $session->redirect($url) in PW is a 301 (permanent) redirect. If you want a 302 redirect then give it a second param of false, i.e. <?php $this->session->redirect('http://processwire.com'); // 301 permanent redirect $this->session->redirect('http://processwire.com', false); // 302 temporary redirect http://processwire.com/api/variables/session/ Link to comment Share on other sites More sharing options...
Pete Posted November 6, 2011 Author Share Posted November 6, 2011 Cheers Ryan - i'll update the module tomorrow. Link to comment Share on other sites More sharing options...
Pete Posted November 7, 2011 Author Share Posted November 7, 2011 Updated to v 1.0.4 to make redirects temporary (302) instead of permanent (301) - original post contains the updated file. Thanks to ryan for pointing that out. Link to comment Share on other sites More sharing options...
ryan Posted November 7, 2011 Share Posted November 7, 2011 Pete, thanks for your great work on this module! Link to comment Share on other sites More sharing options...
netcarver Posted March 30, 2012 Share Posted March 30, 2012 (edited) Pete, Great module! Does 90% or more of what I needed right out of the box. I've added the ability to redirect to external URLs to your v1.0.4 code and pushed it to github as v1.0.5. I submitted a pull request should you find it worthy of inclusion in your module. Thank you. Edited March 30, 2012 by netcarver Link to comment Share on other sites More sharing options...
Pete Posted March 30, 2012 Author Share Posted March 30, 2012 Cheers Steve I'll merge that soon as it's very useful! There was a looping issue mentioned under very specific circumstances (something about a user who's not a superuser getting an infinite redirect) by someone recently too so I'll investigate that at some point next week and put any and all changes into a new version. Link to comment Share on other sites More sharing options...
alan Posted September 17, 2012 Share Posted September 17, 2012 Thanks Pete and contributors for this excellent module! 2 Link to comment Share on other sites More sharing options...
ceberlin Posted May 17, 2013 Share Posted May 17, 2013 I like the module a lot. Thank you for this! One idea: I would find a 2 step maintenance extremely useful: a) EMERGENCY - Leave only the Superadmin in (as it is now) - good for updates and for working on the database. b) NORMAL MAINTENANCE - apply a new Permission "bypass_maintenance" to a role which is given access to the backend next to the Superadmin. - good for developing. Link to comment Share on other sites More sharing options...
Pete Posted June 2, 2013 Author Share Posted June 2, 2013 Updated this to v1.0.6. You can now add optional roles that can bypass maintenance mode (superuser will always bypass regardless of whether it's selected or not!). @ceberlin - this should help with your scenario 2 Link to comment Share on other sites More sharing options...
ceberlin Posted June 3, 2013 Share Posted June 3, 2013 Thank you VERY much, Pete! Link to comment Share on other sites More sharing options...
Marco Angeli Posted June 4, 2013 Share Posted June 4, 2013 ...using this module for my first processwire project: very useful indeed! Thanks Pete! Link to comment Share on other sites More sharing options...
Marco Angeli Posted June 20, 2013 Share Posted June 20, 2013 Hi everybody, quick update: I downloaded last version of the module and set the site in "Maintenance Mode" (with an exception for Superuser and guest): unfortunately the site was still visible to everybody... did I miss anything? If I remember well, last version worked like a charme... Link to comment Share on other sites More sharing options...
Soma Posted June 20, 2013 Share Posted June 20, 2013 Superuser will always bypass see three posts above pete explains. The guest role is for public visitors. Link to comment Share on other sites More sharing options...
Marco Angeli Posted June 20, 2013 Share Posted June 20, 2013 Hi Soma, I know that superuser will always bypass but I wanted to add another user with "guest" role. Doing this, (I tested it again) the site becomes visible to everybody. How to show the site to a guest role without giving him full permissions? Link to comment Share on other sites More sharing options...
kongondo Posted June 20, 2013 Share Posted June 20, 2013 .....but I wanted to add another user with "guest" role. Doing this, (I tested it again) the site becomes visible to everybody. How to show the site to a guest role without giving him full permissions? Am confused. Guest has view rights and that is everybody - the public. If you want the guest to view the site, it beats the logic of placing it in maintenance mode. Also, what are these full permissions for the guest? The full extent of the guest user's permissions is page-view. The only role they have is view pages. Are you talking of another user next to the superuser as requested in post #33? Link to comment Share on other sites More sharing options...
Marco Angeli Posted June 20, 2013 Share Posted June 20, 2013 hi kongondo, Are you talking of another user next to the superuser as requested in post #33? short answer: yes. As Pete said, I'd like to add an optional role that can bypass maintenance mode, but I don't want to give him the possibility to edit, delete or move pages. It's only a preview for a client before I teach him how to use PW. How can it be done? Link to comment Share on other sites More sharing options...
kongondo Posted June 20, 2013 Share Posted June 20, 2013 Marco, I haven't used this module, but from looking at the code, I think you will first need to create a role (e.g. "client"). Give that role the limited permissions you want. Create a user, e.g. "paul" and assign "paul" to the role "client". Then, in the module, add "client" as the role to bypass. Link to comment Share on other sites More sharing options...
kongondo Posted June 20, 2013 Share Posted June 20, 2013 OK, I have now tested it and it doesn't seem to show any other roles in the drop down besides guest and supersuser. @Pete, is that a bug? Tested on PW 2.3 Link to comment Share on other sites More sharing options...
ceberlin Posted December 18, 2013 Share Posted December 18, 2013 HI Pete, now I am using the DEV version. There is something funny: I set the module to redirect to the login page (default behavior). The "is in maintenance" info appears twice at the login screen. Maybe one time with the redirect and one time calculated new. Because it is only one time after I refresh the login page. Another idea: It would be great if the switch to put the maintenance mode on and off would be more accessible as a separate admin "setup" page and available to certain user roles - and not buried in the module's settings. Link to comment Share on other sites More sharing options...
ceberlin Posted December 20, 2013 Share Posted December 20, 2013 One more observation: The green label "This site is in maintenance" destroys my page setup and makes design testings tricky. If there was a css class with it, I could overwite the included hard coded styles more easily. 1 Link to comment Share on other sites More sharing options...
diogo Posted December 22, 2013 Share Posted December 22, 2013 Agree. It should definitely have a class. And styling should be in an external css and not inline. @ceberlin, I think the best thing for you to do is to add the class on the module itself. Link to comment Share on other sites More sharing options...
ceberlin Posted December 22, 2013 Share Posted December 22, 2013 Hi diego, sure I can edit modules like this one myself. Adding a class is not that difficult This would disconnect the module from the update path and this is against the idea of community delivered turn-key solutions? Link to comment Share on other sites More sharing options...
diogo Posted December 22, 2013 Share Posted December 22, 2013 I'm not saying it's the ideal solution. The ideal would be Pete reading this and changing it on the module. We can also make a pull request to him, of course. 1 Link to comment Share on other sites More sharing options...
pers0n Posted February 28, 2014 Share Posted February 28, 2014 Great to know a module like this exists Another alternative is to modify the .htaccess file and do a temporary redirect 302 to say a html file at the root called /maintenence.html and then when the site is out of it, edit the .htaccess file to no longer redirect everything to that page and then do a permanent redirect 301 back to the regular homepage / for anyone going to maintenence.html. The visitors won't know any difference Now you might ask, how the admins would login, well if you know your IP address you can allow just that IP to not be redirected Another alternative, is to only redirect everything but whats in your /admin/ directory (whatever you have it named, hopefully something else), granted noone would be able to preview the site 2 Link to comment Share on other sites More sharing options...
horst Posted February 28, 2014 Share Posted February 28, 2014 Now you might ask, how the admins would login, well if you know your IP address you can allow just that IP to not be redirected I don't have a static IP and I use a special string within the UserAgent, for example: RewriteCond %{HTTP_USER_AGENT} !^.*(b346a0b6fe9d440d68e07c9619c0ba0a).*$ This way (with switching UserAgent of the browser) I am able to look to the site as admin and like the public from the same IP. 3 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now