![]() |
|
Customer Support
Can I have a catch-all subdomain?
You can always create any subdomain (anything.yourdomain.com) that you want by creating a directory or symbolic link in your /htdocs directory as described here.However, if you want a browser to be able to get to your site no matter what subdomain they requested (wwww.yourdomain.com or even anyname.yourdomain.com) without having setup specific directories or symlinks for those requests in advance, then you can use mod_rewrite to redirect their request for a non-existent mis-typed or random subdomain to a valid page at on your website.
To do this, create a text file named .htaccess in your /htdocs directory that contains the following 5 directives, one per line with no other linebreaks (the lines may appear to wrap in your browser now), where each line begins Rewrite...
RewriteEngine on
RewriteCond %{HTTP_HOST} ^([a-z0-9]+)\..+\..*$ [NC]
RewriteCond /full/path/to/homedirectory/htdocs/%1 !-d
RewriteCond /full/path/to/homedirectory/htdocs/%1 !-l
RewriteRule ^(.*)$ http://www.yourwebsite.com/ [L,NS]
where "/full/path/to/homedirectory" is the full path to your home directory as described after the 2nd paragraph here, and where "www.yourwebsite.com" leads to an area of your website for which you have properly created files in your /htdocs/www directory.
User-Contributed Notes |
|||
|
|||
|
|||
|
|||
|
|
|||
Related Questions:
Why does it say "directory not empty" when I try to remove a directory?
How do I create subdomains?
How do I get telnet or SSH access to the server?
What is the real full path to my home directory?
Where do I put my webpages and files?
How do I upload and edit my files?
Why do I keep getting old copies of my pages when I just updated and changed my files?
How do I change my password?
When will my site be activated?
How do I get to one of my subdomains from a temp.modwest.com or secure.modwest.com URL?
Can I switch my domain name or alter my administrator username?
How do I recreate the "_" symlink that directs mydomain.com to www.mydomain.com?
Why do I Get an Error Page When Accessing Webmail with Internet Explorer?
What kind of resource limits do you have for your shared hosting environment?
Can I display a "Secured by RapidSSL" seal on my site?
Browse Categories:Getting Started, FTP, Telnet/SSH, Moving Domains, E-mail, Traffic Reports, Mailing Lists, Apache, PHP, CGI, Other Server-Side Scripting, MySQL Database, Imaging Libraries, Other Software, Billing & Terms, Control Panel, E-commerce, Pre-Sales |

