DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   PHP (http://www.daniweb.com/forums/forum17.html)
-   -   .htaccess troubles (http://www.daniweb.com/forums/thread180604.html)

alexgv14 Mar 9th, 2009 12:56 am
.htaccess troubles
 
I have a .htaccess file which forwards non www request to www

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^mysite.com [NC]
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.

freshfitz Mar 9th, 2009 1:34 am
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">

alexgv14 Mar 9th, 2009 1:48 am
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

Shanti Chepuru Mar 9th, 2009 1:55 am
Re: .htaccess troubles
 
i have tried this..
its worked fine for me...
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^mysite\.com [NC]
RewriteRule ^(.*)$ http://www.mysite.com/$1 [R=301,L]

alexgv14 Mar 9th, 2009 2:11 am
Re: .htaccess troubles
 
Quote:

Originally Posted by Shanti Chepuru (Post 821198)
i have tried this..
its worked fine for me...
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^mysite\.com [NC]
RewriteRule ^(.*)$ http://www.mysite.com/$1 [R=301,L]

That worked perfectly thank you.

Shanti Chepuru Mar 9th, 2009 2:24 am
Re: .htaccess troubles
 
hey,,,
have u tried rewrite conditions in your .htaccess file..
the explain me...please...


All times are GMT -4. The time now is 4:40 am.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC