mod rewrite - Mod_rewrite to switch HTTP to HTTPS -
i trying use bluehost supplied ssl wildcard certificate switch 1 subdomain https.
the web root contains many subdomains, , want affect test. subdomain.
going web root, i've written following .htaccess file:
rewritecond %{server_name} ^test.mydomain.com rewritecond %{https} off rewriterule (.*) https://%{http_host}$1
yet hitting http://test.mydomain.com/admin/index.php not redirect me https://test.mydomain.com/admin/index.php.
even cutting out condition of server_name, still doesn't work.
is rewrite rule bad?
well, in first place in wrong .htaccess file. needed go directory subdomain.
then, switching http http apparently causes kind of redirect www. behavior.
i had
a) preserve existing rules not intended test. b) add test. rules.
it added lot.
rewriteengine on rewritebase / rewritecond %{http_host} !^test.example.com$ rewriterule ^index\.php$ - [l] rewritecond %{http_host} !^test.example.com$ rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /index.php [l] rewritecond %{http_host} ^test.example.com$ rewritecond %{https} off rewriterule (.*) https://%{http_host}%{request_uri} rewritecond %{http_host} ^test.example.com$ rewritecond %{request_uri} !^/test/ rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule (.*) /test%{request_uri} rewritecond %{http_host} ^test.example.com$ rewriterule ^(/)?$ test/admin/index.php [l]
Comments
Post a Comment