I currently have WordPress installed in the base path of my server. WordPress uses htaccess for user-friendly URL’s. In addition I have the need of wildcarded subdomains, as I have users wanting to access a specific system.
When the user visits http://www.domain.com, or just domain.com, they should be served WordPress. If they are requesting giraffesinafrica.domain.com, the dir should be set to /system/ (a folder in base path)
In the folder /system/ i have another .htaccess controlling the URLS redirected into that..
I hope someone can lead me on the way 🙂
Thanks in advance!
RewriteEngine On
# 3. internal redirect to the shop
RewriteCond %{REQUEST_URI} !-f
RewriteCond %{HTTP_HOST} ^([^.]+)\.domain\.com$
RewriteRule ^(.*)$ subdomain/ [L,NC,QSA]
# BEGIN WordPress
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ./index.php [L]
# END WordPress
You talk about /system, while your code uses /subdomain, so I will use the latter.