Jump to content

How to keep Admin panel on subdomain while frontend is to be on subdirectory?

Recommended Posts


My client has a specific need where they need the website to be hosted in a subdirectory in the root domain; but need the admin panel to be accessible only via subdomain.

They say this is for the security purpose.

Frontend: https://example.com/app/

Backend: https://appadmin.example.com

Anyway I can quickly achieve this?


Thanks a lot.



Share this post

Link to post
Share on other sites
Posted (edited)

Hello @ivineet9,

Welcome to the forums 🙂.

3 hours ago, ivineet9 said:

Anyway I can quickly achieve this?

Most likely using a RESTFUL API or multi-instance ProcessWire if both sites are on the same file system. Mind, these will only get you as far as the data. If you want to 'see' the admin of the other site in the backend site, you will need to develop a Process Module.

3 hours ago, ivineet9 said:

but need the admin panel to be accessible only via subdomain

There are a couple of threads in the forums that discuss how the admin panel can be locked down to 'mimick' not accessible (redirects after login, hard-to-guess-admin-url, ProcessWire outside webroot, etc) but you cannot fully get away from an admin (unless I have missed new a trick or two).

Edited by kongondo

Share this post

Link to post
Share on other sites

I think that should be a lot easier. You can setup any vhost you want on your server to access your website, eg website.com, website2.com, or as subdomain admin.example.com.

So you setup 2 vhosts, one that points to the root dir with the folder containing your pw installation, so that you can access the frontend (example.com/app) and one that points directly to the app folder (eg admin.example.com)

In admin.php you add some PHP to check for $config->httpHost and block access to the admin if the request comes from example.com or www.example.com.

In ready.php you add some PHP that redirects requests coming from admin.example.com to admin.example.com/yourpwadminurl

--> if anybody visits admin.example.com he/she will be redirected to admin.example.com/yourpwadmin

--> users visiting example.com/app/yourpwadmin will be redirected to example.com/app (or blocked via 404, as you like)

  • Like 1

Share this post

Link to post
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.

  • Similar Content

    • By humanafterall
      I'm looking at how I might achieve the following with Processwire:
      A low-bandwidth version of a website, on a subdomain (eg text.mydomain.com), where the content/database is exactly the same as the top level domain, but a new set of templates is used so the site is stripped back to just very simple CSS/low quality images.
      I'm looking and trying to work out what might be best — is it multi-site from the same database? Multi-instance? API? 
      Any guidance or experience of a similar setup would be much appreciated.
    • By Shailaja
      I have a subdomain. Now i dont to use that subdoamin so i have deleted but if I open the subdomain it is redirecting to 404 page.
      Thank you in advance.

    • By Entice
      I'm trying to figure out what might be the best approach when using PW for your CMS, but needing access custom tables. I know you can query your custom tables, so that's not my question here. What I'm trying to figure out is if I should separate an application from PW.
      Out of the box, the application I will be using has its' own tables and the app is built towards using those tables, so I don't want to rewrite the app to use PW, seems too much work.

      I do however want to use PW for the CMS and frontend where my users can add/update rows in those custom tables. Now the app itself can be connected from various devices on a handful of ports, so I'm expecting a high volume of requests to the app to a point where I'm seriously considering a dedicated server for this project.
      Would it be beneficial to create a whole subdomain just for the app and use PW to query the db? Or should I keep the 2 in the same db? Pros/Cons would be great here.
    • By John W.
      Summary: If I have a site sitting on a server called testing.com, then on the server change it to mycompany.com, do I have to modify any settings in ProcessWire?
      After building several processwire for clients, the one question that I haven't had is about moving a processwire site from an old (temporary) domain to a new domain.
      For instance, I typically setup development sites for clients and register a temporary domain (and lock with a password). For instance, thee client can go test.com and get all their content finalized, change wording, add news, swap out photos -- everything to make the site production read.  
      Next, on my hosting account I can have testing.com renamed to theircompany.com - and change the nameservers.
      A simple question here. If I have a hosting company rename the account from testing.com to theircompany.com, change my nameservers whereas going to theircompany.com loads the production site, Is there anything I need to change in the processwire configuration or in the PW database?
      In the past, I've just manually copied the site, and fresh-installed PW, and imported the data. Seems like a lot of hassle.
      I have a second part question about updating the PW core, however, after consideration I'll post it as a new topic.
    • By Dennis Spohr
      Hi all,
      I have problems to keep my session on different subdomains (including www).
      I've set the following config:
      $config->sessionCookieDomain = '.mydomain.net'; $config->sessionCookieSecure = false; But it doesn't work, I always loose the session when I switch between www.mydomain.net and example.mydomain.net.
      Could it be because both of them have a different SSL-Certificate? (https)
      Thanks for any help!
  • Create New...