kala-tamin Domain to point to a single page

Domain to point to a single page

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

Domain routing to directory, .htaccess or DNS-magic?


.htaccess and mod_rewrite
You could definitely do something like this:.
Rewriting URLs with Mod_Rewrite
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:.
URL Redirection and htaccess security - redirecting non-authenticated users off-site to a live server
RewriteCond %{HTTP_HOST} ^(www\.)?domain2\.com\.au$ RewriteRule (.*) /second.php [L] 
Edit: Now that you've posted a snippet try this instead:.
htaccess rules filtered on IP
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] 

Htaccess help, $1 being used before its set??? what?

Remove .htaccess in subdirectory


Is there a way to create subdomain like url redirection using .htaccess?
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.

81 out of 100 based on 41 user ratings 741 reviews