Tuesday, March 20, 2012

Subdomains with Cakephp

Although Cakephp's .htaccess is not well documented for various reasons, it is lacking one simple intuitive example that would help many people. By design, the .htaccess file in the root directory points to the app/webroot folder. This means, that it will find direct to any document located at app/webroot/document by www.example.com/document automatically. The trouble comes into play when the same names are used within your cakephp app.

Now that the ground work is layed, how do I have a subdomain like ie.example.com?

Most common webhosting interface is the control panel. On this control panel is a location where subdomains are created and there should be an option to create redirects. It is here that you want to point ie.example.com to www.example.com/ie.

If ie is in app/webroot and no other naming disputes occur, this will work like magic.

No comments:

Post a Comment