PHP problem with 301 Redirect

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
manchuwok
Forum Newbie
Posts: 1
Joined: Thu Dec 17, 2009 3:12 pm

PHP problem with 301 Redirect

Post by manchuwok »

Hi all,

First time poster here! I have run into a problem while trying to implement a 301 redirect via my site's .htaccess file. I have used 301 redirects with success before, but this is the first time dealing with this problem.

I want http://www.mysite.com to redirect to http://mysite.com. My 301 redirect does send the user correctly, but the problem is that it displays this URL:

http://mysite.com/index.php?/

In contrast, if I type http://mysite.com directly into the browser, I do not see this /index.php?/

To make things easier, here is a look at my .htaccess file:

RewriteEngine on
RewriteCond $1 !^(ADMIN|images|tools|themes|favicon\.ico|robots\.txt|index\.php) [NC]
RewriteRule ^(.*)$ /index.php?/$1 [L]

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

Any thoughts on what I am doing wrong here?? Thank you!!
godwinsam
Forum Newbie
Posts: 9
Joined: Wed Sep 16, 2009 11:01 pm

Re: PHP problem with 301 Redirect

Post by godwinsam »

Hello,

Please find the following link,
http://yopensource.com/en/tutorials/joo ... developer-
Here we can able to see the 16 steps for .htaccess
Please find it. I think this is helping you to fix the problem..

Regards,
Post Reply