.htaccess problem

# Use PHP5 as default
#AddHandler application/x-httpd-php5 .php

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

Works, but this doesn’t: (added the www thing)

# Use PHP5 as default
#AddHandler application/x-httpd-php5 .php

#FORCE www
RewriteEngine on
RewriteCond %{HTTP_HOST} ^mysite\\.com$ [NC]
RewriteRule ^(.*)$ http://www.mysite.com/$1 [R=301,L]

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

Any ideas? The 2 lines I added to force “www” works on my other sites. I’m guessing the WordPress part is messing it up… does anyone know how I can rewrite it for it to work?

mmelen,

That’s the standard WP code (but you should KNOW NOT to leave the <IfModule> braces around the mod_rewrite code - that makes the same test for EVERY file request and is an ABUSE of the server slowing every request for your domain AND all other domains on that server).

The force www code SHOULD be adding a / after your domain for every cycle through the mod_rewrite. Check my signature’s tutorial for the {REQUEST_URI} version.

Other than that, it’s likely that your configuration of WP is for the www-less domain name. Check that, too.

Regards,

DK

Hey, good tips - thanks! I’ll follow your steps and let you know if I get it fixed.