.htaccess - htaccess rewrite subdomains to 1 file -
i helping site , want template page (example.com/template) shown on each of subdomains.
so when user navigates a.example.com
or b.example.com
, etc.
they see example.com/template.php
but url stays a.example.com
or b.example.com
, etc.
i know there way can't figure out.
want able change of pages @ once making change 1 file.
i think close code keep 500 errors
rewritecond %{http_host} ^$.example.com$ [nc]
rewriterule ^$ $1.example.com/template.php
ps: these actual domains, not virtual
have
rewriteengine on rewritecond %{http_host} ^.+\.dfwfamilylifenews\.com [nc] rewriterule ^$ /template.php [l] # begin wordpress <ifmodule mod_rewrite.c> rewriteengine on rewritebase / rewriterule ^index\.php$ - [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /index.php [l] </ifmodule> # end wordpress
firstly, make sure rewrite module loaded in apache. see this answer more info.
second, need change rules to:
rewritecond %{http_host} !^www\. [nc] rewritecond %{http_host} ^.+\.example\.com [nc] rewriterule ^$ /template.php [l]
Comments
Post a Comment