Jump to content

Http to https redirection is not working correctly


Recommended Posts


i would like to use for my Processwire project a secure https connection instead of a regular http connection. For this reason i installed a valid ssl certificate and added a new htaccess rule and condition to my htaccess file: 

RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://domain.tld/$1 [R,L]

Now, when i try to access the page via „http://domain.tld/application/xyz“ i get redirected to „https://domain.tld/?it=application/xyz“. Does anyone know how the rule must be adjusted so that the rewriting is still working correctly? The problem only appears if the user comes from a http url.



Link to comment
Share on other sites

Actually, you can do this from within PW itself without resorting to htaccess rewrites (if you want to.)

Edit your templates and look at the URLs tab. There is a section there where you can define which scheme the page should be served as. Switch over each template representing pages that you need served via https and save them. Your pages should now be directly accessible via the https scheme and if you try to access them via http you should be redirected to https.

  • Like 3
Link to comment
Share on other sites


I just tried this on my https site and the automatic PW redirect doesn't seem to be working so I've opened an issue on github for the problem.

In the meantime, you could try this in the top of your template files...

if (!$config->https) {

Just build the landing url as you want or use the current url and substitute the https scheme.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...