.htaccesshttp-redirectmod-rewritepermanent

subdomain and subfolder .htaccess


I would honestly appreciate any input, I have beent rying to do this for 2 days! I have 2 servers, one is my webserver w/Plesk running on a Digital Ocean droplet - another running a game server.

I was wondering if it's possible to use a sub-domain on my droplet and redirect to a sub-folder in /var/www/html/somefolder on my game server. I currently have my sub.domain.com configured with an A record to my game server's IP.

My question is, how can I make use of my .htaccess files to make this happen?


Solution

  • I've found a solution in case anyone else comes across this issue :D

    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^subdomain\.yourdomain\.com
    RewriteRule ^(.*)$ http://www\.yourdomain\.com/subdomain/$1 [L]