Jump to content

detect www


dlf1987

Recommended Posts

Hi, how do i detect if the user is logged on to my site through http://www. or just http://?

 

I want to be able to redirect people to http://www.

 

The main reason why im asking is because my cookies from the http:// domain, dont show up on http://www.

 

I think theres a way with apache rewrite, but i run PHP on Windows IIS6 so i dont think rewrite works.

 

Thanks!

Link to comment
https://forums.phpfreaks.com/topic/93176-detect-www/
Share on other sites

Thanks for the help, but i figured it out from php.net...

 

http://uk3.php.net/manual/pl/function.setcookie.php

 

"To make the cookie available on all subdomains of example.com then you'd set it to '.example.com'. The . is not required but makes it compatible with more browsers. Setting it to www.example.com  will make the cookie only available in the www  subdomain. Refer to tail matching in the » spec for details."

 

 

Link to comment
https://forums.phpfreaks.com/topic/93176-detect-www/#findComment-477380
Share on other sites

you can do .htacess

my webhost has a FAQ and it has that in it, here is what it says:

 

You are able to make your web site always appear with the address www.lamezz.com.

 

Please use the follwoing code in a .htaccess file to redirect your url

from lamezz.com to www.lamezz.com.

-------------------------------

Options +FollowSymlinks

RewriteEngine on

RewriteCond %{HTTP_HOST} ^lamezz.com [NC]

RewriteRule (.*)$ http://www.lamezz.com/$1 [L,R=301]

-------------------------------

 

You are able to make this redirection for any of your domain names on your Servage account.

 

since I was logged on with my account it uses www.lamezz.com, just replace it with yours, I have tried it before, and it works!

Link to comment
https://forums.phpfreaks.com/topic/93176-detect-www/#findComment-477462
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.