I have a shared hosting with one domain and one sub-domain (for mobile and clients). Each domain and sub-domains has different default index pages. The hosting company told me to put everything in my .htaccess file since I don't have access to the httpd.conf.
What I want to do is this:
DirectoryIndex
should be: index.html
DirectoryIndex
should be: mobile-index.html
DirectoryIndex
should be: post.php
DirectoryIndex
should be: vote.php
Edit:
In addition, if I go to domain1.com/page/ the DirectoryIndex
should be: index.html
. If I go to mobile.domain1.com/page/ the DirectoryIndex
should be: mobile-index.html
What can I put in my .htaccess file in order to change the DirectoryIndex
for each sub-domain?
Thank You very mich
<IfDefine>
does not work like that. <IfDefine>
only runs when apache starts. You should go with a mod_rewrite solution. view @tzakrajs answer.
You can use this in your .htaccess file:
SetEnvIf Host ^www\. page=www
SetEnvIf Host ^mobile\. page=mobile
rewriterule ^.*$ test.php?subdomain=%{ENV:page} [QSA,L]
Simply just configure all your sub-domain using SetEnvIf
and then simply let the PHP do its magic.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With