0

When i past this code, it redirects my whole website. But when i want to go to ticket.mysite.com it gives me the 404 because it redirects me to www.ticket.mysite.com but i don't want this with a subdomain.

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]

I have already tried to past a code without the above in the map from the subdomain, but this doesn't work.

bodgit
  • 4,751
  • 16
  • 27
MaikelVE
  • 3
  • 2

1 Answers1

1

You would do better to set up virtual hosts. You need at least three from what I can see; a default example.com, www.example.com, and ticket.example.com. You can then place a simpler RewriteRule in the default vhost that redirects any request to https://www.example.com/$1. Then when the client hits either the www.example.com or ticket.example.com vhosts there are no RewriteRule's. See https://httpd.apache.org/docs/2.4/vhosts/examples.html.

bodgit
  • 4,751
  • 16
  • 27