Page 1 of 2

htaccess mod rewrite

Posted: Thu Sep 10, 2015 7:30 pm
by Loriath
Umm Ok, how do I state the issue.

Okay, when I come to the Forums, I get there by www.elitepve.com and its all good, till someone posts a link to another thread, then it links to just elitepve.com which my system on both browsers, Chrome and Firefox see as a separate site and I therefore am not logged in due to cookies being for domain www.elitepve.com not elitepve.com which are in fact two different domains.

Is there something you can do in mod rewrite or the board, or in cpanel subdomains to make the two equivalent ?


Also, since I have this window open, there is an issue with the editor and some of the buttons there. I have a Blank button for Youtube embeds (no icon) and no button at all for the {code} shortcode. The Youtube button is sort of redundant when you have the video icon. (yes I know the brackets are wrong, I used those instead to show up with having to manual type the code brackets.

Thanks

Re: htaccess mod rewrite

Posted: Thu Sep 10, 2015 7:34 pm
by UnmarkedBoxcar
Definitely a question for Wolf/Flip...but probably Wolf? Not sure whose "bag" that is :D

First time I've heard this issue, actually. Are there other folks out there having trouble with cookies, etc...?

I know that EU and NA deal with Cookies a little differently as well (though I am largely, largely ignorant). But I think that's mainly from a legal, not a technical standpoint?

Re: htaccess mod rewrite

Posted: Thu Sep 10, 2015 9:19 pm
by Loriath
Its not a cookie issue Boxcar. It is a domain issue. For Example: joe.site.com is not the same as site.com, it is a subdomain. Most hosts provide you with a main Cname address, such as site.com and also for backwards compatability, direct http://www.site.com to the main site.com so they are equals. if that was the case, then the dns alias would tell my browser that these domains are equivalent. (or this could be done in mod rewrite for Apache webserver)

But for some reason, whether it is in the rewrite rules (don't make me explain that one lol I don't have the time) or the dns records or in the subdomain settings, they are not, and it means the browser does not see them as equal. This means that anyone that does not accept Third Party cookies, like me so I don't get all the tracker crap when I visit most sites (like facebook, ad sites, etc..), sees them as separate sites.


Technically, if they wanted to, they could make unmarkedboxcar.elitepve.com point directly to your profile page here on the forums (or for all of us). but that is a waste of resources.

Re: htaccess mod rewrite

Posted: Thu Sep 10, 2015 10:16 pm
by Skipp
this is not necessarily an issue with the server. Actually - it might not be an issue at all - rather a tiny "feature" of the forum itself.

I haven't been using PHPBB for ages, but i'm an admin on a big SMF forum, and I manage tons of wordpress sites and they have one thing in common - "base" url set in their settings.

Both Wordpress and SMF use that field so the scripts know where the base URL of your forum/website installation is. So - if you type in www.domain.com it will always rout you there. If you type in domain.com - it will show it without.

Now, this can be fixed with .htaccess, but it really isn't necessary since you can just open your forum options and set it there.

The reason for this is so you can actually set it without the www. prefix because some shared hosting firms don't offer rewrites, and you might get a hosting where your site won't work if you just type in domain.com without the www. prefix

Re: htaccess mod rewrite

Posted: Fri Sep 11, 2015 7:31 am
by Wolf
Loriath wrote:Its not a cookie issue Boxcar. It is a domain issue. For Example: joe.site.com is not the same as site.com, it is a subdomain. Most hosts provide you with a main Cname address, such as site.com and also for backwards compatability, direct http://www.site.com to the main site.com so they are equals. if that was the case, then the dns alias would tell my browser that these domains are equivalent. (or this could be done in mod rewrite for Apache webserver)

But for some reason, whether it is in the rewrite rules (don't make me explain that one lol I don't have the time) or the dns records or in the subdomain settings, they are not, and it means the browser does not see them as equal. This means that anyone that does not accept Third Party cookies, like me so I don't get all the tracker crap when I visit most sites (like facebook, ad sites, etc..), sees them as separate sites.


Technically, if they wanted to, they could make unmarkedboxcar.elitepve.com point directly to your profile page here on the forums (or for all of us). but that is a waste of resources.


Hi Loriath,

I took some time to try to understand what you would like me to achieve by rewrite rules. In the case of elitepve.com there are two A records, one witha dn one without www, both pointing to the same IPs (v4 and v6). The webserver then treats both exactly the same, meaning pointing to the same home directory.
This is exactly what a rewrite rule would also achieve if the both names would not point to the same home by default. So adding a rewrite rule would change nothing. (Rewrite changes what is served, not what your browser thinks it sees). For example, try going to http://elitepve.com/app.php/page/about, and then to page/about. In this case it's mod rewrite that is serving you the same content for both.

Now the cookie that is set by the site has elitepve.com as domainname, no matter which name you used to access it. (Again, rewrite would not change that). Your browser is throwing a tantrum over that. ;)

There are two things I could do: first i could change the cookie domain to www.elitepve.com, but that would mess up all cookies already set, and would cause the same issue for you if you start by elitepve.com without www. Or I could implement a http redirect from www.elitepve.com to elitepve.com to force you to use that variant, what would result in a reload everytime someone comes via the www extension.

The first solution is just the same as before but vice versa, the second solution makes no sense, if both names point to the same content anyway, IMHO.

If i have totally misunderstood the problem, please let me know.

Regards
Wolf

Re: htaccess mod rewrite

Posted: Fri Sep 11, 2015 7:58 am
by Skipp
Wolf, check your general forum settings. The problem described is most certainly set there. Here's a screenshot of my SMF installation. If I was to change the URLs in those setting to the domain name WITHOUT the www. prefix - everything would be re-routed to the domain name without www (obviously). If you just type in www. the forum itself will just point to the full domain with the www. prefix.

At least this is the case with SMF and Wordpress

Re: htaccess mod rewrite

Posted: Fri Sep 11, 2015 9:49 am
by Wolf
Skipp wrote:Wolf, check your general forum settings. The problem described is most certainly set there. Here's a screenshot of my SMF installation. If I was to change the URLs in those setting to the domain name WITHOUT the www. prefix - everything would be re-routed to the domain name without www (obviously). If you just type in www. the forum itself will just point to the full domain with the www. prefix.

At least this is the case with SMF and Wordpress

Hi Skipp,

I have checked again, everything is set to elitepve.com without www.
I did some more research and i think I found Loriaths issue. The cookie is set to elitepve.com, as I said before. In order for Loriaths preferrence to come to http://www.elitepve.com I should set it to '.elitepve.com'. When I was starting the board almost a year ago, I was not looking into that and it never changed.

Now I can of course do that, BUT: Every cookie set so far will be invalidated by that. So I will have a lot of users suddenly logged out and most importantly not able to log in if they do not clear their cokkies.
I will have to make an announcement that everybody has to clear their cookies and relogin in order to access the site, if I don't want a lot frustrated users.

Re: htaccess mod rewrite

Posted: Fri Sep 11, 2015 9:53 am
by Loriath
Well whatever fixes it because I am sure I am not the only one that this affects but I am probably the most vocal (whodathunkit :) )

What about the button issues? Is it on my end?

Re: htaccess mod rewrite

Posted: Fri Sep 11, 2015 10:03 am
by Wolf
Loriath wrote:Well whatever fixes it because I am sure I am not the only one that this affects but I am probably the most vocal (whodathunkit :) )

What about the button issues? Is it on my end?


It's the first time I have heard of it. My Browsers (Both Firefox and Chrome) accept the cookie no matter which of the two urls I use.

For the buttons I have no idea. Try hitting reload once while in the editor. Possibly my changes to the custom css file (already several months ago ; ) ) never was loaded by your browser. They are kinda lazy when it comes to those and the name didn't change ;)

Regards
Wolf

Re: htaccess mod rewrite

Posted: Fri Sep 11, 2015 10:12 am
by Wolf
Wait a second! I just checked: The cookie domain IS set to '.elitepve.com'!
(Before I was just reading docs about possible causes for your issue)

So really, i have no idea what is causing the behaviour you see. Anybody else having troubles with the 'remember me' login?

(Edit: Or even without remeber me. It works for me every time on every browser...)

Cheers
Wolf