Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Aug 2012
    Posts
    44
    Thanks
    26
    Thanked 0 Times in 0 Posts

    [SOLVED] Session problem with "http://www."

    Hello,

    The php session in my web is not working when I use the address "http://www.myweb.com".

    When I use "http://myweb.com" everything is working.

    This is quite annoying.

    Is there a way of get rid of the "www." automatically? or maybe there is a way to make the php session work in both "http://www.myweb.com" and "http://myweb.com"?

    Thanks a lot!
    Last edited by cast_no_shadow; 10-29-2012 at 02:23 PM.

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,865
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    Is there a way of get rid of the "www." automatically?
    Yes, you may redirect all www request to a no-www equivalent, by adding the following lines in .htaccess file (assuming you are using an apache server) of website's root
    Code:
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
    RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • Users who have thanked abduraooft for this post:

    cast_no_shadow (10-29-2012)

  • #3
    New Coder
    Join Date
    Aug 2012
    Posts
    44
    Thanks
    26
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by abduraooft View Post
    Yes, you may redirect all www request to a no-www equivalent, by adding the following lines in .htaccess file (assuming you are using an apache server) of website's root
    Code:
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
    RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
    Thanks that solved my problem!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •