.htaccess redirect help (not blackhat)

Status
Not open for further replies.

JoeZ

New member
Dec 13, 2006
342
9
0
39
Tampa
I just want to forward someone from domain.com to www.domain.com

I was trying to use .htaccess command:

Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^domain.com [nc]
rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc]

My problem is that it is actually forwarding me to www.domain.com/index.php. When it does this, all the images are also forward there, so I get:
img src=http://www.domain.com/index.php/image1.jpg

I tried removing the $1, but then it doesn't forward you to the proper page. Help please :)
 


[FONT=Verdana,Helvetica,Arial][FONT=Verdana,Helvetica,Arial]This should work

RewriteEngine On
RewriteCond %{HTTP_HOST} !www.domain.com
RewriteRule ^.*$ http://www.domain.com%{REQUEST_URI} [R][/FONT][/FONT]
 
RewriteEngine On
RewriteCond %{HTTP_HOST} ^yourdomain\.com [NC]
RewriteRule (.*) http://www.yourdomain.com/$1 [R=301,L]
 
Thanks guys...works great now. I didn't try yours, casidnet, just tried Icecube's first and it worked.

Thanks again.
 
Status
Not open for further replies.