<p>I have a wildcard subdomain enabled and dynamically parse the URL by passing it as-is to my <code>index.php</code> (ex. <code>somecity.domain.com</code>).  </p>

<p>Now, I wish to create a few subdomains that are static where I can install different application and not co-mingle with my current one (ex. <code>blog.domain.com</code>).</p>

<p>My <code>.htaccess</code> currently reads:</p>

<pre><code>RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</code></pre>

<p>Can I manipulate this <code>.htaccess</code> to achieve what I need? Can it be done through Apache?</p>

[{'answer_id': 59382, 'author': 'changelog', 'author_id': 5646, 'author_profile': 'https://Stackoverflow.com/users/5646', 'pm_score': 0, 'selected': False, 'text': '<p>You\'ll have to configure apache for those static sub-domains. The "catch-all" site will be the default site configured, so that one will catch the other ones.</p>\n'}, {'answer_id': 59403, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 0, 'selected': False, 'text': '<p>I\'m not sure I understand completely what you need to accomplish, but it might helpful to setup virtual domains within your Apache configuration file. You can map them to folders on the drive with different applications installed. Each virtual domain is treated much like a root directory. I have my development environment setup locally on my Windows machine a lot like this:</p>\n\n<pre><code>NameVirtualHost *:80\n\n# Begin virtual host directives.\n\n&lt;VirtualHost *:80&gt;\n\n# myblog.com virtual host.\n\nServerAdmin webmaster@myblog.com\nDocumentRoot "c:/apache_www/myblog.com/www"\nServerName myblog.com\nServerAlias *.myblog.com\nErrorLog "c:/apache_www/myblog.com/logs/log"\nScriptAlias /cgi-bin/ "c:/apache_www/myblog.com/cgi-bin/"\n\n&lt;Directory "c:/apache_www/myblog.com/www"&gt;\n    Options Indexes FollowSymLinks\n    AllowOverride All\n    Order allow,deny\n    Allow from all\n&lt;/Directory&gt;\n\n&lt;/VirtualHost&gt;\n</code></pre>\n\n<p>If this does not help get you on the right track, then try researching the VirtualHost directive to come up with a solution. I find trying to do all this in an .htaccess to be cumbersome and difficult to manage.</p>\n'}, {'answer_id': 59405, 'author': 'Vinko Vrsalovic', 'author_id': 5190, 'author_profile': 'https://Stackoverflow.com/users/5190', 'pm_score': 1, 'selected': False, 'text': '<p>Your .htaccess does nothing useful, as Apache is probably configured with DirectoryIndex index.php. Well, it does move domain.com/a  to domain.com/index.php, but I doubt that is what you want.</p>\n\n<p>Your wildcard virtualhost works because you probably have ServerAlias *.domain.com in your configuration, or a single virtualhost and DNS pointing to the address of your server. (When you have a single virtualhost, it shows up for any request, and the first listed virtualhost is the default one)</p>\n\n<p>You have to create new VirtualHosts for the static domains, leaving the default one as, well, the default one :)</p>\n\n<p>Check <a href="http://httpd.apache.org/docs/2.2/vhosts/examples.html" rel="nofollow noreferrer">these</a> <a href="http://wiki.apache.org/httpd/ExampleVhosts" rel="nofollow noreferrer">tutorials</a> that explain it all.</p>\n'}, {'answer_id': 59773, 'author': 'SeanDowney', 'author_id': 5261, 'author_profile': 'https://Stackoverflow.com/users/5261', 'pm_score': 0, 'selected': False, 'text': "<p>I don't know if you have cPanel installed on your host, but I was able to do this by adding a new subdomain <code>*</code> and then sending all that traffic to a particular subdomain, for example: <code>*.domain.com -&gt; master.domain.com</code>. Then you can read out which URL you are at in master.domain.com and go from there.</p>\n"}]
['https://Stackoverflow.com/questions/59380', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/6140/']