Need help with 301 Redirect w/.htaccess

I was able to get this working on most of my web sites. However, I'm having trouble with this one. It has some other scripting which I have no idea what it is and I'm sure it's conflicting with what I'm trying to add. I need my existing code to still function which handles friendly url's, but still want to add new code to do the 301 redirect.

When adding in the couple lines that I added on my other sites it produces an error when testing the redirect at domain.com (without www):

Moved Permanently

The document has moved here.

Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.
Apache/2.2.24 (Unix) mod_ssl/2.2.24 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 Server at domain.com Port 80


Here is the Current .htaccess file on the site:

<IfModule mod_rewrite.c>

Options -Indexes

RewriteEngine On
RewriteBase /


RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^_assets.
RewriteCond $1 !^(index\.php|images|robots\.txt|css|js|print-image\.php)
RewriteRule ^(.*)$ /index.php/$1 [L]

</IfModule>

<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php

</IfModule>

Open in new window



I was trying to add:

rewritecond %{http_host} ^domain.com [nc]
rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc] 

Open in new window


But when I do it gives me the "Moved Permanently" page.

Thanks for your help or suggestions!
tonyhhiscAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

GaryCommented:
Are you placing the www rewrite rule first? If not it should be.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tonyhhiscAuthor Commented:
Thanks ! I added it lower down in the file and all seems to be working now. Thank you!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.