Vesta Control Panel - Forum

Community Forum

Skip to content

Advanced search
  • Quick links
    • Main site
    • Github repo
    • Google Search
  • FAQ
  • Login
  • Register
  • Board index Main Section Web Server
  • Search

How redirect subdomain.example.com to example.com:port

Questions regarding the Web Server
Apache + Nginx, Nginx + PHP5-FPM
Post Reply
  • Print view
Advanced search
4 posts • Page 1 of 1
Rhodwulf
Posts: 3
Joined: Wed Feb 07, 2018 1:32 am

Os: Ubuntu 15x
Web: apache + nginx
How redirect subdomain.example.com to example.com:port
  • Quote

Post by Rhodwulf » Thu Feb 08, 2018 6:39 am

Hi....

I have an issue, i created a subdomain for my irc server,and i want to redirect all the traffic from irc.example.com to example.com:ircport , because i have a webirc installed on my site.

I configured a .htaccess file and dont work, i try a redirect since an index.php and index.html and dont work.

¿Why if i create a subdomain this redirect me to the folder of the principal domain?


Thanks in advance.
Top

putude
Posts: 10
Joined: Fri Oct 13, 2017 6:41 am

Os: CentOS 6x
Web: apache + nginx
Re: How redirect subdomain.example.com to example.com:port
  • Quote

Post by putude » Thu Feb 08, 2018 11:11 am

I don't know is it work or not, but you may try it.

RewriteEngine On
RewriteCond %{HTTP_HOST} ^irc.example.com$ [NC]
RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^(.*)$ http://example.com:ircport$1 [R=301,L]
Top

Rhodwulf
Posts: 3
Joined: Wed Feb 07, 2018 1:32 am

Os: Ubuntu 15x
Web: apache + nginx
Re: How redirect subdomain.example.com to example.com:port
  • Quote

Post by Rhodwulf » Thu Feb 08, 2018 5:41 pm

Precisely it is the code that i used in the .htaccess file

I forgot to mention that if I write irc.example.com/index.html this show the default page of vesta, my doubt is still because irc.example.com redirects me to example.com and does not read the files in the folder.


Thanks.
Top

noogen
Posts: 66
Joined: Thu Jan 05, 2017 9:20 pm

Re: How redirect subdomain.example.com to example.com:port
  • Quote

Post by noogen » Sat Feb 10, 2018 4:24 am

Now you're making confusing statement. Did the redirect work? If so, then why do you care if index.html show the Vesta default?

If it didn't work, then did you put irc.example.com into the Aliases field of example.com? If you just point the DNS to IP address and didn't setup in the web panel/tab, then that's the reason why it's pointing to default Vesta index.

Also, are you setup with apache or nginx+php-fpm? .htaccess only work with apache. If you're on nginx+php-fpm and is seeing the redirect, then it may be your app that is redirecting. Example, you can set the default domain in Wordpress and it'll redirect for you without htaccess.
Top


Post Reply
  • Print view

4 posts • Page 1 of 1

Return to “Web Server”



  • Board index
  • All times are UTC
  • Delete all board cookies
  • The team
Powered by phpBB® Forum Software © phpBB Limited
*Original Author: Brad Veryard
*Updated to 3.2 by MannixMD
 

 

Login  •  Register

I forgot my password