HTACCESS 301 redirect not working

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
hasan
Forum Newbie
Posts: 2
Joined: Sun Apr 12, 2009 11:11 am

HTACCESS 301 redirect not working

Post by hasan »

i am new to htaccess. I have been using the following code to perform 301 redirect:

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

This is not working correctly in all browser. I am using firefox,IE,Flock and Safari. This is not working in IE. Also in few other computers, its not working in firefox or any other browser.

I am looking for a solution badly. Please help

Thanks
amargharat
Forum Commoner
Posts: 82
Joined: Wed Sep 16, 2009 2:43 am
Location: Mumbai, India
Contact:

Re: HTACCESS 301 redirect not working

Post by amargharat »

use following code in your htaccess

Code: Select all

RewriteCond %{HTTP_HOST} ^yourdomain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.yourdomain.com$
RewriteRule ^/?$ http://www.yourdomain.com/index.php [R=301,L]
hasan
Forum Newbie
Posts: 2
Joined: Sun Apr 12, 2009 11:11 am

Re: HTACCESS 301 redirect not working

Post by hasan »

amargharat wrote:use following code in your htaccess

Code: Select all

RewriteCond %{HTTP_HOST} ^yourdomain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.yourdomain.com$
RewriteRule ^/?$ http://www.yourdomain.com/index.php [R=301,L]
thanks for the help but this did not work out..
Post Reply