MyBB Community Forums

Full Version: Redirect standard domain to a www. domain using 301 htaccess redirect
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Redirect standard domain to a www. domain using 301 htaccess redirect

Example: You would like nadlerzforum.com to became www.nadlerzforum.com always, even if you input nadlerzforum.com domain in your browser, it will automatically convert to a www. url.

Redirect to www (htaccess redirect)

Create a .htaccess file with the below code, it will ensure that all requests coming in to nadlerzforum.com get redirected to www .nadlerzforum.com

The .htaccess file needs to be placed in the root directory of your old website (i.e the same directory where your index file is placed)
Example: /public_html

Quote:Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^nadlerzforum.com [nc]
rewriterule ^(.*)$ http://www .nadlerzforum.com/$1 [r=301,nc]

Please REPLACE nadlerzforum.com and www .nadlerzforum.com(no spaces) with your actual domain name.

Note* This .htaccess method of redirection works ONLY on Linux servers having the Apache Mod-Rewrite moduled enabled.

Original Thread