I have two applications on the same server and use apache rewrite rules to redirect:
- www requests to non www
- http reuests to https
Everything works ok, except one case:
request www.test2.test.eu is redirect to https://www.test1.com content
How can I konfigure it properly?
Rewrites in domain test1.com config file:
ServerName test1.com
RewriteCond %{HTTP_HOST} ^www.test1.com$ [NC]
RewriteRule ^(.*)$ https://www.test1.com/$1 [R=301]
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^.*$ https:// %{SERVER_NAME}%{REQUEST_URI}
Rewrites in domain test2.test.eu config file:
ServerName test2.test.eu
RewriteCond %{HTTP_HOST} ^www.test2.test.eu$ [NC]
RewriteRule ^(.*)$ https://www.test2.test.eu/$1 [R=301]
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^.*$ https:// %{SERVER_NAME}%{REQUEST_URI}
Any suggestions very appreciated.
Kind regards.