1
shy1ntx
Redirects in XOOPS (RE: Multiple log in requests)
  • 2005/6/21 14:22

  • shy1ntx

  • Just popping in

  • Posts: 33

  • Since: 2005/6/3 1


Ok, so I think I have narrowed it down. This issue goes to a previous posting I made in respect to users getting multiple log in requests when navigating my site. (They would log in ...go to an area then try to go somewhere else within the site and be asked to log in again.)

I think I have narrowed the issue down to URL and cookies. Most users will come to my site by following the address:

http://www.mysite.com

HOWEVER - the XOOPS login script and subsequent redirects are:

mysite.com

See the slight variation in the URL? (there is no "www") Thus, with the redirects by the login script and XOOPS code for all links within the site, I believe the cookies are different and the session is invalid - thus the users must log in again.

IS there a way to fix this within Xoops? I asked my hosting company (in which I used Fantasico to install Xoops) and they said:

Quote:
That script isn't setting the cookies very well. Cookies can be set to allow www or any subdomain of that domain to access the cookie.


Anyone offer assistance?

2
JamesSAEP
Re: Redirects in XOOPS (RE: Multiple log in requests)
  • 2005/6/21 14:27

  • JamesSAEP

  • Just can't stay away

  • Posts: 732

  • Since: 2005/2/28


I believe if you change the mainfile.php file for the setting:

Quote:
define('XOOPS_URL', 'http://www.domain.com');


Here you will put either the http://www.domain.com or http://domain.com

3
shy1ntx
Re: Redirects in XOOPS (RE: Multiple log in requests)
  • 2005/6/21 14:37

  • shy1ntx

  • Just popping in

  • Posts: 33

  • Since: 2005/6/3 1


Excellent.... thanks for the quick response!!

Is it possible to add both variations so users that are now using the work around will not be left out in the cold...

something like:

Quote:

define('XOOPS_URL', 'http://www.domain.com','http://domain.com);


I doubt that syntax is correct.... but would like to be able to go either way. However, I will check this syntax and change it to include the www since I would prefer it to have the url as such since most users will type in the www.

Is there a another way to accept cookies or define acceptable cookies for the website (Xoops code)

4
DonXoop
Re: Redirects in XOOPS (RE: Multiple log in requests)

There has been lots of discussion of this subject. I hope there will eventualy be more flexibility in future versions (like SSL in specified areas).

What I do is use .htaccess (Apache). I use a mainfile.php setting without the www.

example:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.domain.ca$
RewriteRule .* http://domain.ca/$1 [R=301,L]

On mine I add all the other domains and variations that also point to my site. This way people come in in any way but are redirected to the configured URL before getting logged in.

5
shy1ntx
Re: Redirects in XOOPS (RE: Multiple log in requests)
  • 2005/6/21 14:57

  • shy1ntx

  • Just popping in

  • Posts: 33

  • Since: 2005/6/3 1


Quote:

DonXoop wrote:
What I do is use .htaccess (Apache). I use a mainfile.php setting without the www.

example:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.domain.ca$
RewriteRule .* http://domain.ca/$1 [R=301,L]

On mine I add all the other domains and variations that also point to my site. This way people come in in any way but are redirected to the configured URL before getting logged in.


DonXoop-

That is probably exactly what I want...however I am at a loss with that bit of coding...smile. I think I follow the basic idea..but where i do it and the actual codes (ie: "$" and the [R=301,L]) baffle me. I also heard that .htaccess and access to Apache may be difficult with some hosting companies. (Tho I am not sure on this.)

Granted, I am a newbie and will need to do further research...smile.

Thank you very much DonXoop!!

6
DonXoop
Re: Redirects in XOOPS (RE: Multiple log in requests)

It is pretty common for hosting companies to allow .htaccess. What you want to do is to create a text file and name it ".htaccess" (without the quotes but with the period in front, no .txt or other extention). Place this file in your XOOPS root directory.

An example of a complete .htaccess file:

IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti* */backups/* */templates_c/* */cache/*

php_value register_globals 0

<Files "mainfile.php">
Order allow,deny
Files>

RewriteEngine on
RewriteCond 
%{HTTP_HOST} ^www.domain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.otherdomain.ca$
RewriteRule .* http://domain.com/$1 [R=301,L]


This file several things. It prevents casual browsing of files/directories that they shouldn't be looking at. It sets register_globals Off. It prevents attempting to view the mainfile.php file. Finally it traps the www version of the domain and a second domain that points to the same site and redirects them to the URL that I configure in mainfile.php

Hope this helps.
*/

7
shy1ntx
Re: Redirects in XOOPS (RE: Multiple log in requests)
  • 2005/6/21 15:32

  • shy1ntx

  • Just popping in

  • Posts: 33

  • Since: 2005/6/3 1


Ok that makes sense on where to put the file.

So...and I am going to show my total ignorance now....

For the rewrite area: I would just replace my domain info into that script? Since I only have one instance that I am concerned about I could leave out the second part of the RewriteCond script?

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.mysite123.com$ [OR]

RewriteCond %{HTTP_HOST} ^www.otherdomain.ca$


RewriteRule .* http://mysite123.com/$1 [R=301,L]


Spaced only for illustration purposes. I am also assuming that [R=301,L] is nothing I technically need to be worried about since it is probably over my head and just part of the script

This would in essence make anyone that types "www.mysite123.com" be rewritten to "mysite123.com" which would go well with how the XOOPS script and links are set up on my site - as well as all the referrers/cookies should work (at least in theory if I understand.)

Thanks so much for the help!!

8
DonXoop
Re: Redirects in XOOPS (RE: Multiple log in requests)

Yep, you got the idea now.

You'll know quickly if you have a syntax problem. If you get errors you can edit the file and try again. If you get really stuck then just rename .htaccess to anything else and it will be ignored. Then try again when time permits.

good luck.

9
shy1ntx
Re: Redirects in XOOPS (RE: Multiple log in requests)
  • 2005/6/21 15:51

  • shy1ntx

  • Just popping in

  • Posts: 33

  • Since: 2005/6/3 1


Thans a million! Your help and quick responses are great!

-Eric

10
shy1ntx
Re: Redirects in XOOPS (RE: Multiple log in requests)
  • 2005/6/21 18:34

  • shy1ntx

  • Just popping in

  • Posts: 33

  • Since: 2005/6/3 1


Looks good so far.

There was an .htaccess file in the root, so I just added the code you suggested.

Of course got an error. (its my luck!!)

But decided to go line by line...I took out:

php_value register_globals 0

and that seemed to work..... (not too detrimental to leave that out I am assuming??- Plus, not sure exactly what it does...lol)

THUS-
So far no multiple log in requests are being reported.


Again...thanks for everything.

Login

Who's Online

217 user(s) are online (126 user(s) are browsing Support Forums)


Members: 0


Guests: 217


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits