Multiple URLs - same server

Hi all,

I know there have been postings regarding this, which I’ve read, but
continue to be spinning wheels.

I am attempting to implement two URL’s for our server (for posting
purposes, let’s call them example1.com and example2.com) that point to
two separate applications…using Apache and Mongrel.

example1.com points to the first app, bert…which is at /var/ruby/SS/;
example2.com will point to the second app, earnie…which is a namespace
under /var/ruby/SS (var/ruby/SS/app/views/earnie,
var/ruby/SS/app/controllers/earnie,
var/ruby/SS/app/models/earnie…etc).

example1.com and example2.com have both been added to DNS
server…example1.com works great, however I’m still attempting to get
example2.com to redirect to the second app. If go to
example2.com/earnie...it works great, however I want example2.com to
redirect to example2.com/earnie. Right now it just continues to bring
up the first app (example1.com).

Any suggestions (or am I completely off-base with my approach)?

Below are the VirtualHost entries in my Apache config:

<NameVirtualHost *>

<VirtualHost *>
ServerName www.example1.com
ServerAlias www.example1.com
ProxyPass /images!

RewriteEngine On
#Rewrite rule to redirect all requests to https
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]

<VirtualHost *>
ServerName www.example2.com
ServerAlias www.example2.com
ProxyPass /images!

Rewrite On
#Rewrite rule to redirect all requests to https
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
#Rewrite rule to redirect requests to earnie
RewriteRule^https://www.example2.com$ https://www.example2.com/earnie
[L,R]

Thanks,
Brian

I notice that you’re redirecting to https. For that to work, you will
need to have separate IP addresses because the SSL is made at the IP
level before the name is known. After that, only one name will work
(unless perhaps you have a wildcard certificate and you’re talking
about subdomains, but your examples were top-level domains).

-Rob

On Nov 22, 2010, at 2:07 PM, Brian P. wrote:

SS/;
redirect to example2.com/earnie. Right now it just continues to bring
ServerAlias www.example1.com
ProxyPass /images!
Brian
.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
.

Rob B.
[email protected] http://AgileConsultingLLC.com/
[email protected] http://GaslightSoftware.com/

Rob B. wrote in post #963175:

I notice that you’re redirecting to https. For that to work, you will
need to have separate IP addresses because the SSL is made at the IP
level before the name is known. After that, only one name will work
(unless perhaps you have a wildcard certificate and you’re talking
about subdomains, but your examples were top-level domains).

-Rob

On Nov 22, 2010, at 2:07 PM, Brian P. wrote:

SS/;
redirect to example2.com/earnie. Right now it just continues to bring
ServerAlias www.example1.com
ProxyPass /images!
Brian
.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
.

Rob B.
[email protected] http://AgileConsultingLLC.com/
[email protected] http://GaslightSoftware.com/

Thanks Rob…seeing how the second app is only an anonymous survey
application and wouldn’t necessarily require SSL, I’ve alted the
example2 VirtualHost to the following:

<VirtualHost *>
ServerName www.example2.com
ServerAlias www.example2.com
ProxyPass /images!

Rewrite On
#Rewrite rule to redirect requests to earnie
RewriteRule^http://www.example2.com$ http://www.example2.com/earnie
[L,R]

However, what displays now (using http, not https) is the index page of
my document root (/var/ruby/SS/public). I’m sure I’m overlooking
something, but just not experienced with mod rewrites to know exactly
what.

On Nov 22, 2010, at 2:58 PM, Brian P. wrote:

On Nov 22, 2010, at 2:07 PM, Brian P. wrote:

.

However, what displays now (using http, not https) is the index page
of
my document root (/var/ruby/SS/public). I’m sure I’m overlooking
something, but just not experienced with mod rewrites to know exactly
what.

I suspect that you need a few more things:

DocumentRoot /var/ruby/SS/public/
<Directory /var/ruby/SS/public/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all

I don’t think you need the Rewrite stuff at all.

-Rob

Rob B.
[email protected] http://AgileConsultingLLC.com/
[email protected] http://GaslightSoftware.com/