WordPress htaccess overrides rewrite rule
-
Hi All,
I’m having a problem with rewriting urls with wordpress.
I have my blog in a subdomain like: blog.domain.com
Whenever someone types domain.com/blog I want them to be redirected to blog.domain.comI’m using the following in htaccess:
RewriteCond %{HTTP_HOST} ^domain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.domain.com$
RewriteRule ^blog(.*)$ http://blog.domain.com [R=301,L]This code works if wordpress’ default htaccess is removed, which is:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>If I keep this code however, url domain.com/blog doesn’t get redirected, and I get a 404 page error.
But of course, removing the wordpress default htaccess breaks wordpress down.Anyone has any solution to make it work?
The topic ‘WordPress htaccess overrides rewrite rule’ is closed to new replies.