Forum Moderators: phranque
The problem that I've run into is cookies are enabled for www.domain.com I currently use this snippet (think I even found it on here) to redirect [domain.com...] requests to [domain.com...]
Snippet:
RewriteCond %{HTTP_HOST} ^domain.com [NC]
RewriteRule ^(.*)$ [domain.com...] [L,R=301]
What I've been losing hair folicles over is, some users find it fun (or something) to go to:
whatevertheywant.domain.com
which then removes settings that are set by cookies.
Is there a way to only allow www.domain.com (or a subdomain...will post about that too in a different topic).
THANK YOU SO MUCH FOR THE HELP!
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
Jim
any suggestions. Thank you much.....
Below is the code snippet:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
RewriteRule ^(iqc)(.*) http://www.example.com/imagehosting.php?$2 [NC]
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
BY THE WAY JDMORGAN....your code worked flawlessly. Thank you again.
Note that in that second case, the first set of parentheses isn't needed, since you are discarding "iqc". So you can remove those parentheses, and back-reference $1 instead of $2.
Jim