It is difficult to say without knowing the actual responsibilities of each domain / application / independently. This is what you have to answer based on the requirements of your project ... there is no single strategy that can be recommended for each use case.
With that said, I think that you have the tasks of two applications: one will serve as an interface, and also include the functionality of "members". Resonance, I think this tug is probably a sinlge application because you want to generate links to one from the other (which is incredibly difficult to do if they are separate applications) - i.e. Everyone has access to the home page and answers frequently asked questions, but only users have access to the Downloads or something else, but still they are one and the same site.
Another application is designed for the backend and supports administrator functions. No matter how many applications you can use the same web directory, create a symlink and then specify apache accordingly:
cd htdocs ln -s SF_ROOT_DIR/web frontend ln -s SF_ROOT_DIR/web backend
Now you can point your htdocs/frontend set to htdocs/frontend for domain.com and members.domain.com and point admin.domain.com before htdocs/backend .
Then you can change your .htaccess to look something like this:
Options +FollowSymLinks +ExecCGI <IfModule mod_rewrite.c> RewriteEngine On
That way you can use no_script_name for both applications.
Another way to do the same is to change index.php to the following:
require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php'); if(0 === strpos($_SERVER['SERVER_NAME'], 'admin'){ $app = 'backend'; } else { $app = 'frontend'; } $configuration = ProjectConfiguration::getApplicationConfiguration($app, 'prod', false); sfContext::createInstance($configuration)->dispatch();
You can change the definition of the application name, but you like the idea.
Using both approaches, you can make a basic definition based on a subdomain, and you can apply this strategy regardless of the number of applications that we are talking about if you use only my recommended 2 or if you use 3.
An alternative is to make one home application. Assuming each application is just one facet of the overall application, I like to go this route. However, I would consider members, non-members, and administrators too broad a definition of modules.
If you did this, you could end up with an insane amount of action in the controllers. Instead, I would make separate modules for real problems. Also, there is no real reason to use subdomains here - itβs much easier to just use a URL segment (like / admin or / members) to use specific modules.
For example, it allows you to accept users ... Usually theres will be the admin area, so we can use the admin generator for this function and call the UserAdmin module or something like that. Then, for userland material, we could just have a User module that handles viewing and listing a common profile, editing a profile by users, and all that. Then for the actual login, we can have a UserAuth module that strictly processes things like login / logout and forgotten password requests, and what not. You can redirect any URL to any of these modules, so your routing might look something like this:
user_login: url: /login params: {module: UserAuth, action: login} user_logout: url: /logout params: {module: UserAuth, action: logout} user_password: url: /forgot-password params: {module: UserAuth, action: recoverPassword} user_reset: url: /password/reset/:token params: {module: UserAuth, action: resetPassword} user_profile: url: /members/:username params: {module: user, action: showProfile} user_index: url: /members params: {module: User, action: index} user_default: url: /members/:action params: {module: User} admin_user: class: sfDoctrineRouteCollection options: Module: UserAdmin model: User prefix_path: /admin/user
The final step is to make sure that you protect the appropriate modules and actions with the appropriate credential requirements in security.yml and that you also assign the credentials accordingly.