Link to home
Start Free TrialLog in
Avatar of tonyhhisc

asked on

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 (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


Open in new window

I was trying to add:

rewritecond %{http_host} ^ [nc]
rewriterule ^(.*)$$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!
Avatar of Gary
Flag of Ireland image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of tonyhhisc


Thanks ! I added it lower down in the file and all seems to be working now. Thank you!