Domain to point to one page

I am trying to point the domain name to one page and keep the domain the same (no redirection).

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

If the user types: www.domain2.com.au -> they show up to www.domain1.com.au/second.php but the url still says www.domain2.com.au.

Can this be done with .htaccess?

Snippet of the current .htaccess file:

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 www.domain2.com.au needs to render the page www.domain1.com.au/two which is really www.domain1.com.au/index.php/two

+2


source to share


2 answers


You can 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 be like this:



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

      

Edit: Now that you've posted the 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]

      

+1


source


You want to show a different site than the URL.

This requires proxying.



Read this: http://httpd.apache.org/docs/2.0/mod/mod_proxy.html

0


source







All Articles