troubleshooting Question

Need help with 301 Redirect w/.htaccess

Avatar of tonyhhisc
tonyhhisc asked on
Web Languages and StandardsWeb Development
2 Comments1 Solution506 ViewsLast Modified:
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 (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/ Server at 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 !mod_rewrite.c>
ErrorDocument 404 /index.php


I was trying to add:

rewritecond %{http_host} ^ [nc]
rewriterule ^(.*)$$1 [r=301,nc] 

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

Thanks for your help or suggestions!
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros