User login dependant on if there's a "www." in the url

Forum
Last Post
Threads / Messages

Quillink

Member
Member
Joined
Dec 18, 2008
Messages
93
Points
0
Mysidian Dollar
7,188
I've noticed that if you're logged in (on my site and other adoptable sites using this script) that if you log in on "www.site.com/etc" and then switch over to just "site.com/etc" they are logged out. Is there any way around this? Such as automatic redirection to "www.site" or something else?

Thanks in advance. ;)
 
This is because the cookies are set this way.
Perhaps on when it sets the cookies, have it set it both ways? Some people like www, some don't, so you can't win by redirection, I think... :p
 
That's odd. The cookies should work for both versions. I'll look into it.
 
put this in your .htaccess to redirect all non www to www
Code:
Options +FollowSymLinks 
RewriteEngine on 
RewriteCond %{HTTP_HOST} ^yoursite.com [NC] 
RewriteRule ^(.*)$ http://www.yoursite.com/$1 [L,R=301]
 
Hmm doesnt seam to work. :\

I don't need to enable htaccess anywhere, do I?
 
have you change the yoursite.com to your domain?

If it still doesn't work, try to put this code in your .htaccess instead
Code:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^yourdomain\.com$
RewriteRule (.*) http://www.yourdomain.com/$1 [R=301,L]
 
This is what my .htaccess looks like with your code:

Code:
RewriteEngine On

RewriteCond %{HTTP_HOST} arvyre\.com$
RewriteRule (.*) http://www.arvyre.com/$1 [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^get/([0-9]+).gif$ /adoptables200/siggy.php?id=$1 [L]

It doesn't seem to be working. Is there anything incorrect in the extract above?
 
You forgot to put a "^" before arvyre\.com$ on line 3
Code:
RewriteEngine On

RewriteCond %{HTTP_HOST} ^arvyre\.com$
RewriteRule (.*) http://www.arvyre.com/$1 [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^get/([0-9]+).gif$ /adoptables200/siggy.php?id=$1 [L]
oh and I just realized on your registration page the allowed length value for the password and password confirmation box are not the same...shouldn't you be fixing it?
 
fadillzzz said:
oh and I just realized on your registration page the allowed length value for the password and password confirmation box are not the same...shouldn't you be fixing it?

Hmm that's interesting, I haven't edited that text area at all..? Thank's for pointing it out. :D

The .htaccess still doesn't seem to work. :S Any other ideas?
 
hmm...this should be a lot easier if you configure it throught cPanel...don't you have cPanel access to your website?
 
hmm...I'll try to get some info from my friend about this .htaccess problem, cause I just create a test site and its' working fine with the .htaccess I gave you

but anyways, as long as you have a redirection manager on whatever administration panel you're using, I'm sure it should to be easy actually since it's usually have a feature to automaticly redirect non WWW to WWW URL

who's your host anyway?

EDIT: just noticed another problem with your site, the sign out button leads to a 404 error page. I have to type in the logout URL manually to log out from the site
 
Fixed again, thanks.

Still looking for the place in my panel to tell it to redirect, though...
 
ok, try this code

Code:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^arvyre\.com [NC]
RewriteRule ^(.*)$ http://www.arvyre.com/$1 [R=301,L]

if it doesn't work, try this one
Code:
RewriteEngine on

RewriteCond %{HTTP_HOST} !^www\.arvyre\.com [NC]
RewriteRule (.*) http://www.arvyre.com/$1 [R=301,L]
 
Ugh none of them want to work. :S

Don't worry about it though, nobody's even noticed yet. And I'm sure they wouldn't mind re-logging in anyway. Thanks for your time of course. :)
 
you're welcome...
sorry couldn't help you though...
but you can always ask your host about this problem, I'm sure they can help you
 
its strange
the htacces rewrite rule does not works for you ??

how does your pet script works then ?? because it seems then that your .htacces is not supported :S

normal it should work fine , but what you can do to is putting a small php code into the header so it auto redirects if it got a certain value

that will helps a little

here is the code
PHP:
if($_SERVER['PHP_SELF']!= ('www.yourwebsite.com')){ header("Location:http://www.yourwebsite.com"); }

i cant promise that it will works like it should be
because it going redirect all websites that doesnt come from that site to that site

i use it for a register page on my vps to prevend direct acces , but i point them away from that register page so i dont know if this going work like it shoul be
but feel free to give it a try :D

Greets From PowerChaos
 

Similar threads

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

Threads
4,280
Messages
33,130
Members
1,603
Latest member
Monako
BETA

Latest Threads

Latest Posts

Top