Peter Stuart
Peter Stuart

Reputation: 2444

Session not starting when using www

I have a strange problem here.

I am using a directory script running off PHP.

The users have the option to type in their postcode so the directory can use their postcode to find local businesses.

I am using a session to save their postcode.

The problem is when the session postcode ($_SESSION['postcode']) doesn't show when I leave out the "www." in the domain. How can I set it so the postcode will show with/without the www.?

Thanks Peter

Upvotes: 0

Views: 114

Answers (2)

Ali Demirci
Ali Demirci

Reputation: 326

session_set_cookie_params(0, '/', '.domain.com');

Upvotes: 2

Peter Stuart
Peter Stuart

Reputation: 2444

I used the following code and it worked :)

RewriteEngine on RewriteBase / RewriteCond %{HTTP_HOST} ^www.mywebsite.org RewriteRule ^(.*)$ http://mywebsite.org/$1 [R=permanent,L]

Upvotes: 0

Related Questions