943,611 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Marked Solved
  • Views: 451
  • PHP RSS
Mar 9th, 2009
0

.htaccess troubles

Expand Post »
I have a .htaccess file which forwards non www request to www

PHP Syntax (Toggle Plain Text)
  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.
Reputation Points: 10
Solved Threads: 1
Light Poster
alexgv14 is offline Offline
49 posts
since Feb 2008
Mar 9th, 2009
0

Re: .htaccess troubles

Is it a linux server with apache mod-rewrite module installed? Why not use a simple html redirect

Quote ...
<meta http-equiv="refresh" content="2;url=http://www.yoursite.com">
Last edited by freshfitz; Mar 9th, 2009 at 1:34 am.
Reputation Points: 12
Solved Threads: 36
Posting Pro in Training
freshfitz is offline Offline
436 posts
since Sep 2008
Mar 9th, 2009
0

Re: .htaccess troubles

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
Reputation Points: 10
Solved Threads: 1
Light Poster
alexgv14 is offline Offline
49 posts
since Feb 2008
Mar 9th, 2009
0

Re: .htaccess troubles

i have tried this..
its worked fine for me...
PHP Syntax (Toggle Plain Text)
  1. Options +FollowSymlinks
  2. RewriteEngine on
  3. RewriteCond %{HTTP_HOST} ^mysite\.com [NC]
  4. RewriteRule ^(.*)$ http://www.mysite.com/$1 [R=301,L]
Reputation Points: 137
Solved Threads: 162
Posting Virtuoso
Shanti C is offline Offline
1,641 posts
since Jul 2008
Mar 9th, 2009
0

Re: .htaccess troubles

i have tried this..
its worked fine for me...
PHP Syntax (Toggle Plain Text)
  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.
Reputation Points: 10
Solved Threads: 1
Light Poster
alexgv14 is offline Offline
49 posts
since Feb 2008
Mar 9th, 2009
0

Re: .htaccess troubles

hey,,,
have u tried rewrite conditions in your .htaccess file..
the explain me...please...
Reputation Points: 137
Solved Threads: 162
Posting Virtuoso
Shanti C is offline Offline
1,641 posts
since Jul 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: quiz software
Next Thread in PHP Forum Timeline: GetMetaTags Problem





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC