Trying to figure out subdomain server alias redirects.

2 posts / 0 new
Last post
#1 Sat, 03/23/2019 - 00:26
vichudson1

Trying to figure out subdomain server alias redirects.

I’m trying to figure out how to do the following scenario with Virtualmin on Centos with Apache as the server.

I have myserver.domain working and I also have subdomain.myserver.domain working as a server alias for myserver.domain. What I’d like to do is have subdomain.myserver.domain resolve to myserver.domain/subdomain-page when visitors use the subdomain url instead of it going to the sites main home page.

Any help pointing me in the right direction is appreciated.

Sun, 03/31/2019 - 11:11
Gregory.K
  1. remove subdomain.myserver.domain as an alias
  2. create subdomain.myserver.domain as a sub-server
  3. .htaccess redirect to myserver.domain/subdomain-page

.htaccess, something like this (sorry, no time to test it)

RewriteEngine On
RewriteCond %{HTTP_HOST} ^subdomain\.myserver\.domain$ [NC]
RewriteRule ^(.*)$ http://myserver.domain/subdomain-page/ [L,R=302]

Topic locked