views:

84

answers:

2

Hi, I'm trying to point a domain name to a single page, and keep the domain the same (no redirect).

So if a user types: www.domain1.com.au --> original site is shown

If a user types: www.domain2.com.au --> they are shown www.domain1.com.au/second.php, but the URL still says www.domain2.com.au.

Can this be done using .htaccess?

Snippet of current .htaccess file is:

RewriteCond %{HTTP_HOST} www\.domain2\.com\.au [NC] 
RewriteRule (.*) /two [L] 

RewriteCond $1 ^(one|two|three|four) [NC] 
RewriteRule ^(.*)$ /index.php/$1 [L]

So basically the www.domain2.com.au needs to display the www.domain1.com.au/two page, which really is www.domain1.com.au/index.php/two

+1  A: 

You could definitely do something like this:

RewriteCond %{HTTP_HOST} ^(www\.)?domain1\.com\.au$
RewriteCond %{REQUEST_URI} !^/domain1
RewriteRule (.*) /domain1/$1 [L]

RewriteCond %{HTTP_HOST} ^(www\.)?domain2\.com\.au$
RewriteCond %{REQUEST_URI} !^/domain2
RewriteRule (.*) /domain2/$1 [L]

Your exact case would similar to this:

RewriteCond %{HTTP_HOST} ^(www\.)?domain2\.com\.au$
RewriteRule (.*) /second.php [L]

Edit: Now that you've posted a snippet try this instead:

RewriteCond %{HTTP_HOST} www\.domain2\.com\.au [NC] 
RewriteRule (.*) /index.php/two [L] 

RewriteCond $1 ^(one|two|three|four) [NC] 
RewriteRule ^(.*)$ /index.php/$1 [L]
Jason Berry
Hmm, this is giving me a 500 error - I should have mentioned that I'm using SEO friendly domains, so would this conflict? See above for a snippet of my .htaccess file.
mbelos
I've updated my answer to hopefully reflect what you need.
Jason Berry
I think this was on the right track, but unfortunately I'm still getting 500 errors. Must be something else - in any case, I've discovered that there are some major dependencies on the URL in this project (not my doing!) so we need to make it redirect instead. Thanks for your help anyway!
mbelos
A: 

You want to show a different site than what the URL says.

That requires proxying.

Read this: http://httpd.apache.org/docs/2.0/mod/mod%5Fproxy.html

sylvanaar