Tell me more ×
WordPress Answers is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I haved inserted a -usually perfectly fine operating- htaccess condition and rewrite into my standard wordpress .htaccess file in order to redirect to a non-www url when www is prepended. It does not seem to be taken into account at all: when prepending a www, nothing gets rewritten. Mod rewrite is enabled and works for other WP permalink settings. Have searched for similar questions (on google, as wel as the SE network), but all solutions seem to be exactly or essentially the same as mine. Here are my .htaccess contents, domain.com naturally being an alias for my own domain

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www.domain.com$ [NC]
RewriteRule ^(.*)$ http://domain.com/$1 [R=301,L]
</IfModule>

# 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>

# END WordPress
share|improve this question
There is nothing about this that is WordPress specific. It is a strictly .htaccess question. I am not able to make that rule fail, though: htaccess.madewithlove.be – s_ha_dum Nov 23 '12 at 14:58
did you check your wordpress settings, if the blogurl is set to non-www? – fischi Nov 23 '12 at 15:42
I actually assumed it was wordpress specific. It's a rule that is otherwise working perfectly. Also, the rule works when I target a non-wordpress file or directory. The blog-url is non-www too – grrrbytes Nov 24 '12 at 9:14

closed as off topic by kaiser, toscho Nov 23 '12 at 17:44

Questions on WordPress Answers are expected to relate to WordPress within the scope defined in the FAQ. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about closed questions here.

Browse other questions tagged or ask your own question.