.htaccess - How to give a subpage it's own domain name? -
i have joomla site mysite.com
.
i want have subpage mysite.com/example
act separate website using separate domain name anothersite.com
.
can achieved using dns settings on domain , htaccess?
hosting sites @ cloudaccess.net want solution one-page sites , landing pages without using whole other hosting account / joomla instance.
thanks.
if hosting provider allows have "alias" domains, can point new domain @ existing code, , detect hostname using rewritecond
:
- start configuring new domain display same content existing domain.
in apache configuration (probably
.htaccess
on shared hosting) add rule detects requests new domain, , "rewrites" them instead serve specific page:rewritecond %{http_host} landingpage.example.com rewriterule ^/$ /url/for/my/landing/page
add additional rule afterwards other urls on domain redirect browser main site
rewritecond %{http_host} landingpage.example.com rewriterule ^/([^/].*)$ http://realsite.example.com/$1 [r=permanent,l]
a variation of map on second domain directory (or, rather, url prefix) in first domain, combining 2 rules:
rewritecond %{http_host} subsite.example.com rewriterule ^/(.*)$ /url/for/my/subsite/$1 [l]
note: if joomla thinks knows "correct" url page, may try redirect away new domain. if so, topic new question.
if, on other hand, want use apache configuration force users accessing http://realsite.example.com/url/for/my/landing/page
redirected http://landingpage.example.com/
, add this:
rewriterule ^/url/for/my/landing/page$ http://landingpage.example.com/ [l,r=permanent]
note: depending on environment settings don't understand, may need change ^/
^
in patterns above.
Comments
Post a Comment