<p>I'm pretty sure you could achieve that using an .htaccess 301 redirect.</p>

<p>In the domain.com's .htaccess file add:</p>

<pre><code>&lt;IfModule mod_rewrite.c&gt;
  RewriteEngine on
  Redirect 301 /admin http://admin.domain.com/admin
&lt;/IfModule&gt;
</code></pre>

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

<p>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.</p>

CC BY-SA 3.0
2014-06-12T10:15:18.860Z
This assumes that you would be using a shared app path on both sites: define('CRAFT_APP_PATH', '../path/to/shared/app/folder');
Steve Adams
CC BY-SA 3.0
2014-06-12T10:02:25.150Z
2014-06-12T10:02:25.150Z
Steve Adams
<p>You can use the <a href="http://buildwithcraft.com/docs/config-settings#baseCpUrl" rel="noreferrer">baseCpUrl</a> config setting to tell Craft to always generate CP URLs pointing to <a href="http://admin.domain.com" rel="noreferrer">http://admin.domain.com</a>, and you can create a .htaccess redirect on <a href="http://domain.com" rel="noreferrer">http://domain.com</a> pointing all requests to /admin* to <a href="http://admin.domain.com/admin/" rel="noreferrer">http://admin.domain.com/admin/</a>*, but it is <strong>not</strong> 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.</p>

CC BY-SA 3.0
2014-06-13T08:35:59.977Z
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)
Christofer Sandin
CC BY-SA 3.0
2014-06-13T13:30:50.553Z
Not sure I'm following. Maybe email us at support@buildwithcraft.com with more details?
Brandon Kelly
CC BY-SA 3.0
2014-06-12T12:04:11.853Z
2014-06-12T12:04:11.853Z
Brandon Kelly
<p>Is it possible to separate the public site and the Control Panel on separate domains (i.e. <code>www.domain.com</code> and <code>admin.domain.com</code>)?</p>

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

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

<config><control-panel>
How can I run the Control Panel from a separate domain?
# How can I run the Control Panel from a separate domain?

(Asked by: username_0 on 2014-06-12)

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`)

**Tags:** config, control-panel

---

## 2 answers

### Answer by username_2 on 2014-06-12. Score: 6 | Accepted answer

You can use the [baseCpUrl](http://buildwithcraft.com/docs/config-settings#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.

> **Comments:**
> **username_0**: 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)  
> **username_2**: Not sure I'm following. Maybe email us at support@buildwithcraft.com with more details?  

---

### Answer by username_1 on 2014-06-12. Score: 1

I'm pretty sure you could achieve that using an .htaccess 301 redirect.
In the domain.com's .htaccess file add:

  RewriteEngine on
  Redirect 301 /admin http://admin.domain.com/admin


.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.

> **Comments:**
> **username_1**: This assumes that you would be using a shared app path on both sites: define('CRAFT_APP_PATH', '../path/to/shared/app/folder');  

---

