I have just set up the domain properly and everything is working well but when I tried to redirect non-www to www by adding the following lines to htaccess, it throws a 404. Not sure if it's a wp multisite or apache config? Using the bitnami wordpress multisite 3.3.2 aws ami stack.

RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L]

asked 04 May '12, 09:23

Laurent%20Ho's gravatar image

Laurent Ho
16224
accept rate: 0%

edited 04 May '12, 12:47


I think you should remove the last '/' in the RewriteRule. Can you try with the following?

RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com
RewriteRule ^(.*)$ http://www.example.com$1 [R=301,L]
link

answered 04 May '12, 12:34

Carlos%20S%C3%A1nchez's gravatar image

Carlos Sánchez ♦♦
32724
accept rate: 41%

Didn't work either, now it's in a redirect loop. I'm wondering if it was the initial setup process that I mess up, as in:

$ mysql -u root -p -e "USE bitnami_wordpress; UPDATE wp_options SET option_value='http://YOUR_DOMAIN/' WHERE option_name='siteurl' OR option_name='home';"

I should have use www.YOUR_DOMAIN instead of just YOUR_DOMAIN?

(04 May '12, 12:40) Laurent Ho

Yes, it may be the reason. You should configure wordpress with 'www' prefix too or it will redirect to the value you entered in the database.

$ mysql -u root -p -e "USE bitnami_wordpress; UPDATE wp_options SET option_value='http://www.example.com/' WHERE option_name='siteurl' OR option_name='home';"

(04 May '12, 13:07) Carlos Sánchez ♦♦
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×359
×61
×14
×1

Asked: 04 May '12, 09:23

Seen: 922 times

Last updated: 04 May '12, 13:07

powered by BitNami OSQA