How do i create virtual subdomain using htaccess?

How do I create subdomain redirects using .htaccess?

  • I have a main domain MYDOMAIN.COM I want to make it easy for me to remember my Google Apps email URL, so I just want to redirect gmail.MYDOMAIN.CCOM to my Google Apps email URL using .htaccess to do a redirect. How do I do this?

  • Answer:

    A slightly indirect answer... Why don't you just setup DNS for gmail.mydomain.com and instruct Google Apps (via admin panel) to respond to that subdomain? The instructions are right in the admin panel, and very simple to follow. It's a snap.

Angela at Stack Overflow Visit the source

Was this solution helpful to you?

Other answers

To expand on http://stackoverflow.com/questions/1051886/how-do-i-create-subdomain-redirects-using-htaccess/1051898#1051898, this should work in a .htaccess in the directory that represents the root of your subdomain: RewriteEngine on RewriteRule ^/(.*) http://wherever.gmail.com/ or whatever the url is. Without http://httpd.apache.org/docs/2.0/mod/mod%5Frewrite.html, you can use http://httpd.apache.org/docs/2.0/mod/mod%5Falias.html: Redirect permanent / http://wherever.gmail.com/ Although, the http://httpd.apache.org/docs/2.0/mod/mod%5Frewrite.html solution is "better", it's not enabled on all server. http://httpd.apache.org/docs/2.0/mod/mod%5Falias.html however should be.

Matthew Scharley

Assuming Apache, http://httpd.apache.org/docs/2.0/mod/mod%5Frewrite.html will allow you to create redirects like this.

Matthew Iselin

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.