Reputation: 513
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
Upvotes: 2
Views: 447
Reputation: 2469
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]
Upvotes: 1
Reputation: 8216
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_proxy.html
Upvotes: 0