0

Thanks in advance, everyone; this one's a doozy.

I've been tasked with porting a subdomain, that was previously hosted on its own server, into an existing ExpressionEngine installation.

Previously, the site in question was at franchise.domain.com - now that data (or at least the ExpressionEngine Groups/Templates) resides at www.domain.com/franchise .

The question: given my lack of access to httpd (which I presume might be helpful), and given my access to an .htaccess file, how do I point franchise.domain.com to www.domain.com/franchise, in a fashion that's transparent to the end-user?

An additional wrinkle: That same .htaccess file is also being used to hide the /index.php/ that ExpressionEngine requires in order to do its nutty database procedures.

In other words, here's what I need:

The user sees: franchise.domain.com/whatever The server sees: www.domain.com/index.php/franchise/whatever

I've been working at this myself for the last couple days, pouring through Google and the EE Docs, Forums, and Wiki, and unfortunately this is an extremely time-sensitive project - our long-term revenue comes from the sale of our franchises.

Can anyone help?

Relevant lines from .htaccess as follows:

#Temporarily redirect franchise.domain.com to domain.com/franchise, 
#just so we have SOMETHING up
RewriteEngine On
RewriteCond %{HTTP_HOST} franchise.domain.com
RewriteRule ^(.*)$ http://www.domain.com/franchise/$1 [R,L]

#Rewrites domain.com to http://www.domain.com, may be interfering 
#with my attempts, but I'm not sure.
RewriteCond %{HTTP_HOST} ^domain\.com [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]

#Removes /index.php/ from EE urls
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ /index.php/$1 [L]

Unfortunately, I've been unable to make that first set of directives transparent to the end-user... my understanding is that it involves a certain amount of voodoo which is way over my head. (Something about adding a hash or marker, to stop Apache from redirecting infinitely).

Thanks again, everyone.

1 Answers1

0

You need to use mod_proxy either in a reverse proxy configuration or as a redirection with [P] parameter in a RewriteRule. See: http://httpd.apache.org/docs/2.2/mod/mod_proxy.html

Mircea Vutcovici
  • 16,706
  • 4
  • 52
  • 80
  • Would I be able set that all up without access to httpd? – user83845 Jun 08 '11 at 03:07
  • You need access to apache configuration and to be able to restart apache. To test you can create a test server and test all configuration before deploying into production. – Mircea Vutcovici Jun 08 '11 at 03:11
  • Unfortunately, I can't do that... we're running on a managed solution, and the apache config files are strictly forbidden. Is there anything else I can do? – user83845 Jun 08 '11 at 03:13
  • Add another server/VM with an apache configured as reverse proxy and change the DNS to point to the new server. – Mircea Vutcovici Jun 08 '11 at 03:15
  • That sounds like it would take quite a while to set up, and I'm extremely unfamiliar with the mechanics of doing any of that. Is there a less elegant solution using mod_rewrite? Or is it impossible, due to the subdomain issue? – user83845 Jun 08 '11 at 11:32