.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.comor 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

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -