0

I have a website that has custom subdomains for users, e.g. creator.snaprate.me. This works great, but if I manually type in creator.snaprate.me/login the login page (snaprate.me/login) appears.

I'd like to have a redirect to snaprate.me/anypage for any subdomain, but don't know how.

I have the following .htaccess, and this has been working great except for this issue:

RewriteEngine on
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !^((?!www\.)[^.]+).snaprate\.me$
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} ^((?!www\.)[^.]+).snaprate\.me$
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI}
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php [L]

What do I need to add in order to redirect traffic from subdomain.snaprate.me/anypage to snaprate.me/anypage? I'd really like an answer to this; I have been searching for days and still I have no idea what to do -- htaccess is my Achille's heel!

cappycap
  • 29
  • 6
  • Possible duplicate of [Create subdomains on the fly with .htaccess (PHP)](https://stackoverflow.com/questions/586129/create-subdomains-on-the-fly-with-htaccess-php) –  Nov 27 '17 at 01:45
  • @nogad Not a duplicate, I edited to hopefully specify better. – cappycap Nov 27 '17 at 03:06

0 Answers0