.htaccess - how to change site path and create subdomain using htaccess -
i have site index.php located @ server public root.
the url is
http://example.com
i have created subfolder called 'travel' , moved whole site content it.
using .htaccess , how can have site @ adress ( subdomain travel):
http://travel.example.com
why htaccess , why not virtualhost entry in apache config this:
<virtualhost *:80> servername www.example.com serveralias example.com documentroot /www/domain </virtualhost> <virtualhost *:80> servername travel.example.com documentroot /www/domain/travel </virtualhost>
edit .htaccess based solution:
enable mod_rewrite , .htaccess through httpd.conf
, put code in .htaccess
under document_root
directory:
options +followsymlinks -multiviews # turn mod_rewrite on rewriteengine on rewritebase / rewritecond %{http_host} ^travel\.example\.com$ [nc] rewriterule (?!travel/)^(.*)$ travel/$1 [l,nc]
Comments
Post a Comment