Use subdomain for certain urls
-
I have the following rules in my .htaccess file on a WordPress (single installation):
# REWRITE FORUMS DOMAIN TO FOLDER RewriteCond %{HTTP_HOST} ^forums\.example\.com$ RewriteRule !^forums/? forums%{REQUEST_URI} [NC,L]
# REWRITE FORUMS FOLDER TO SUBDOMAIN RewriteCond %{THE_REQUEST} \s/forums/([^\s]*) [NC] RewriteRule ^ https://forums.example.com/%1 [R=301,L]
This is so that the forums that exist at https://example.com/forums are accessed at https://forums.example.com/
However the server just blows up with a 500 server error…
Any ideas on how to do this? These rules work perfectly when used on non-wordpress sites… The second rewrite rules successfully send /forums to the sub domain but the subdomain doesn’t seem to be able to pass the data into WordPress correctly.’
Here is the htaccess file in its entirety:
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / # REWRITE FORUMS DOMAIN TO FOLDER RewriteCond %{HTTP_HOST} ^forums\.example\.com$ RewriteRule !^forums/? forums%{REQUEST_URI} [NC,L] # REWRITE FORUMS FOLDER TO SUBDOMAIN RewriteCond %{THE_REQUEST} \s/forums/([^\s]*) [NC] RewriteRule ^ https://forums.example.com/%1 [R=301,L] # BEGIN WordPress RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] # END WordPress </IfModule>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Use subdomain for certain urls’ is closed to new replies.