Help, please. Can you tell me if this is the correct code to perform the following rewrites? I can't test this particular change like I would like.
This company has four domains in a single apache instance.
I only want to affect one - test.example.com.
I need this block to do the following:
- if the host is test.example.com, any call to / needs to go to /admin/index.php
- if the host is test.example.com, any call to http needs to go to https
RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} !^test\.example\.com RewriteRule ^/admin/index\.php$ - [L] RewriteCond %{HTTP_HOST} !^test\.example\.com RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /admin/index.php [L] RewriteCond %{HTTP_HOST} !^test\.example\.com RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
Thanks so much, Lynn
UPDATE:
How about something like this?
RewriteCond %{HTTP_HOST} !^test\.lifestylepubs\.com RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}$1 RewriteRule ^/$ /admin/index.php
!^test\.example\.com
(with a!
prefix) is a negated regex. So, this matches when theHost
is nottest.example.com
, which would seem to be the opposite of what you were trying to achieve.