MilesWeb Hosting Forum

Web Hosting Technical Support => How To's => Topic started by: Dipak Bhoi on August 17, 2014, 07:02:30 PM

Title: How to domain or subdomain point to different ports ?
Post by: Dipak Bhoi on August 17, 2014, 07:02:30 PM
Hello guys,

If you want to domain or subdomain to be forwarded to the different port for different service then this post will help you. Follow the following instructions.

There are two ways to do this. You could use the VirtualHost section of your httpd.conf or you could do it in your .htaccess file.

In httpd.conf:

Quote<VirtualHost *:80>
    ServerName subdomain.mydomain.com
    redirect / http://mydomain.com:4040/
</VirtualHost>

In .htaccess: Set redirect rule

QuoteRewriteEngine on
RewriteCond %{HTTP_HOST} ^subdomain\.mydomain\.com$ [NC]
RewriteRule ^(.*)$ http://mydomain.com:4040/$1 [R=301]

Enjoy !!!