No matter what url somebody uses to access my site, I'd like it to redirect to www.MyUrl.com. Is this possible?

3 Answers 3


As far as i know there is no way to force the url to uppercase.

As for forcing the www. this can vary as to where you are hosting etc.

Here is one generic way of doing this using your .htaccess file.

# Forcing www. infront of domain
RewriteEngine On
Options +FollowSymLinks
RewriteCond %{HTTP_HOST} ^(domain\.com)$ [NC]
RewriteRule ^(.*)$ http://www.%1/$1 [R=301,L]
  • 3
    You don't even need to use .htaccess to do this. WordPress does it natively. Just update the general settings page to include the www in the site's url. Commented Aug 31, 2010 at 16:22
  • @Matt Ellioot: @John P Bloch is right, modifying .htaccess for this is massive overkill and has the potential to be screwed up accidentally down the road. Much better to define WP_HOME and WP_SITEURL instead. Commented Aug 31, 2010 at 21:55
  • While you can't assume he is running Apache, using .htaccess is much more efficient than doing it within wordpress. Commented Oct 24, 2010 at 21:34

Hi @FigBug:

1.) You can easily force "www" in your domain because WordPress handles it all for you. You'll only need to set two defines in the /wp-config.php file is found in your website's root; this is the same file where your database userid and password is stored.

Add these two lines to your /wp-config.php file somewhere before the require_once(ABSPATH . 'wp-settings.php'); line:


2.) You cannot force domain capitalization. Domains are case-insensitive. Even if you try WordPress will lowercase it.

(So give it up, it ain't happening! :-)

  • Hi Mike, what about in cases where the folder is in a different directory? Would this botch it up. Cheers, Noel
    – Noel Tock
    Commented Jun 10, 2011 at 20:37

There are lots of ways to force a redirect from a given URL to a preferred variant of that URL. Which one you use will depend upon how much control you have over your environment. Some include:

  • Use the WordPress control panel settings.
  • Use the Apache .htaccess URL rewriting capabilities.
  • Use the Apache Redirect permanent directive from the Apache configuration. (All webserver should have a similar mechanism.)

What you have to keep in mind is that domain names are NOT case-sensitive, and in this case the browser will control what gets displayed, not your server. More importantly, each redirection you force will (1) require additional work from your server, (2) increase the complexity of your configuration, and (3) delay your users from accessing your site. If your goal is to enhance your brand (MyUrl instead of myurl) you'd be better served by focusing on the design of your site.

There are two real reasons to implement site redirection to force a given domain:

  1. Reduce search engine confusion (everyone uses myurl.com instead of www.myurl.com or web.myurl.com or
  2. Ensure that all users of a SSL-protected site use the same domain that is registered in the SSL certificate, mostly to prevent error messages and confusion.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.