.htaccess troubles

Thread Solved

Join Date: Feb 2008
Posts: 28
Reputation: alexgv14 is an unknown quantity at this point 
Solved Threads: 0
alexgv14 alexgv14 is offline Offline
Light Poster

.htaccess troubles

 
0
  #1
Mar 9th, 2009
I have a .htaccess file which forwards non www request to www

  1. Options +FollowSymLinks
  2. RewriteEngine on
  3. RewriteCond %{HTTP_HOST} ^mysite.com [NC]
  4. RewriteRule ^(.*)$ http://www.mysite.com/$1 [L,R=301]

However, I have a problem if i were to put into the url mysite.com/test.php it will not forward to the www site. Any help on how i can get this fixed would be greatly appreciated. It does work if I just put mysite.com it will forward it to http://www.mysite.com. It just doesn't work when i add mysite.com/test.php

Thanks.
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 337
Reputation: freshfitz is an unknown quantity at this point 
Solved Threads: 27
freshfitz freshfitz is offline Offline
Posting Whiz

Re: .htaccess troubles

 
0
  #2
Mar 9th, 2009
Is it a linux server with apache mod-rewrite module installed? Why not use a simple html redirect

<meta http-equiv="refresh" content="2;url=http://www.yoursite.com">
Last edited by freshfitz; Mar 9th, 2009 at 1:34 am.
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 28
Reputation: alexgv14 is an unknown quantity at this point 
Solved Threads: 0
alexgv14 alexgv14 is offline Offline
Light Poster

Re: .htaccess troubles

 
0
  #3
Mar 9th, 2009
this wouldnt work because I have multiple websites hosted on this linux server. That would redirect all of the websites that resolve to my ipaddress
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 1,072
Reputation: Shanti Chepuru is on a distinguished road 
Solved Threads: 98
Shanti Chepuru's Avatar
Shanti Chepuru Shanti Chepuru is offline Offline
Veteran Poster

Re: .htaccess troubles

 
0
  #4
Mar 9th, 2009
i have tried this..
its worked fine for me...
  1. Options +FollowSymlinks
  2. RewriteEngine on
  3. RewriteCond %{HTTP_HOST} ^mysite\.com [NC]
  4. RewriteRule ^(.*)$ http://www.mysite.com/$1 [R=301,L]
Be intelligent, But Don't try to cheat.. Be innocent But Don't get cheated..
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 28
Reputation: alexgv14 is an unknown quantity at this point 
Solved Threads: 0
alexgv14 alexgv14 is offline Offline
Light Poster

Re: .htaccess troubles

 
0
  #5
Mar 9th, 2009
Originally Posted by Shanti Chepuru View Post
i have tried this..
its worked fine for me...
  1. Options +FollowSymlinks
  2. RewriteEngine on
  3. RewriteCond %{HTTP_HOST} ^mysite\.com [NC]
  4. RewriteRule ^(.*)$ http://www.mysite.com/$1 [R=301,L]
That worked perfectly thank you.
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 1,072
Reputation: Shanti Chepuru is on a distinguished road 
Solved Threads: 98
Shanti Chepuru's Avatar
Shanti Chepuru Shanti Chepuru is offline Offline
Veteran Poster

Re: .htaccess troubles

 
0
  #6
Mar 9th, 2009
hey,,,
have u tried rewrite conditions in your .htaccess file..
the explain me...please...
Be intelligent, But Don't try to cheat.. Be innocent But Don't get cheated..
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC