Support » Fixing WordPress » mod_rewrite to force www in a url?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Can I ask why you’re trying to do this?

    Sure, but it’s not really answering my question:)

    Because we have an SSL on the www domain, not a wildcard ssl, I need to have it all go www regardless of the access. The ecommerce engine I’ve worked into wordpress when I launch this, will need to make sure everyones on so that it comes up a valid and certified ssl. If someone types in the site would still run ssl, but since the cert is not wildcard, it will come up with a validation warning the user that it’s made for www not *

    Wildcard certs are typically double if not more what a regular cert is, and it’s not a needed expense in this case.

    So, I need the htaccess to forward in real time to avoid any issue with an invalid message to the user, and an insecure transaction.

    Hey bradyjfrey, I know the askapache author that is a really fantastic article!

    Try this:

    Options +FollowSymLinks
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} !^domain\.com$ [NC]
    RewriteRule ^(.*)$$1 [R=301,L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]

    There is also a whole section on using SSL in .htaccess that tackles the same thing as you are dealing with.

    Thanks a bunch cduke250, that should do great, I appreciate it:)!

    I’ve tried both, but the solution has caused other problems. I’ve installed bbpress, but the users that log into Skinplistic WITHOUT the www are not recognized by users that log into bbpress WITH the www. I used the code above to force access via www, however; I noticed this counted multiple hits against my server (I use slimstat). Plus, I think it may be upsetting adsense and the other robots I prey for everyday. 😉 I don’t know what to do.

    You need to stick with either www or no www, it will take the robots a few months probably before they figure out you only want www.

    robotst.txt and seo with wordpress might be helpful for you to understand the duplicate content problem.

    Thank you for the response to my question. I’m a little overwhelmed with SEO and the best approach I can take. I decided to removed the code in my .htaccess file because WordPress kept deleting it (I think). I’ll take a look at the link…again, thank you. One more thing. I ultimately decided to removed bbpress. I now use simple forum. Very, very nice.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘mod_rewrite to force www in a url?’ is closed to new replies.