.htaccess – Subdomain Rewrite Rule
-
Hey!
I’m new to web design/servers, so please pardon me if this post lacks correct jargon.
I’m trying to set up my blog so that it works with a subdomain. The blog is located at marein.org/words, and works fine there. What I’ve also got working is words.marein.org. That seems to redirect/rewrite/go to the first URL.
However, what I haven’t got working yet is pages other than the index. For example, I’d like for words.marein.org/newstart to lead to the same as marein.org/words/newstart (a post on the blog). But at the moment, that first link just leads to a 500 Internal Server Error page.
Someone already gave me this .htaccess code:
RewriteEngine On RewriteCond %{HTTP_HOST} ^words\.marein\.org$ [NC] RewriteRule ^(.*)$ http://marein.org/words/$1 [R=301,L]
Which at first didn’t work, until I removed the code from .htaccess that WordPress told me to put there. To be clear, I mean this code:
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase /words/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /words/index.php [L] </IfModule>
Removing that allowed the other code to do its work, but broke WordPress.
So, my question is, is there a way to combine these two codes so that WordPress works and the subdomain links are rewritten correctly, or perhaps another solution?
Thanks in advance!
- The topic ‘.htaccess – Subdomain Rewrite Rule’ is closed to new replies.