9

Is it possible to separate the public site and the Control Panel on separate domains (i.e. www.domain.com and admin.domain.com)?

With baseCpUrl you're able to force the admin URL to admin.domain.com, but is it possible to also remove the redirect from www.domain.com/admin and completely remove all possible ways to access/redirect to the CP from www.domain.com?

(I guess setting cpTrigger to a random string would be one way, but then you also end up with the admin address similar to admin.domain.com/hjkads78ads5ads785ads68ads67)

2 Answers 2

6

You can use the baseCpUrl config setting to tell Craft to always generate CP URLs pointing to http://admin.domain.com, and you can create a .htaccess redirect on http://domain.com pointing all requests to /admin* to http://admin.domain.com/admin/*, but it is not currently possible to get rid of the CP Trigger segment at this time. Craft relies on that to determine if the current request is a CP request.

2
  • Is it possible to have Craft set the cookie domain to *.domain.com instead of admin.domain.com? (This way we would be able to use the isSystemOn => false setting and still be able to log in to admin.domain.com and then view www.domain.com) Commented Jun 13, 2014 at 8:35
  • Not sure I'm following. Maybe email us at [email protected] with more details? Commented Jun 13, 2014 at 13:30
1

I'm pretty sure you could achieve that using an .htaccess 301 redirect.

In the domain.com's .htaccess file add:

<IfModule mod_rewrite.c>
  RewriteEngine on
  Redirect 301 /admin http://admin.domain.com/admin
</IfModule>

.htaccess rules are processed in order, so you would want this closer to the top.

You might run into an open_basedir restriction from transversing the file system across virtual hosts. If that is the case, how you handle that will depend on your specific hosting setup, so you will need to research the best approach for your config.

1
  • This assumes that you would be using a shared app path on both sites: define('CRAFT_APP_PATH', '../path/to/shared/app/folder'); Commented Jun 12, 2014 at 10:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.