Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

automatically converting a URL to www

by mike_hi (Initiate)
on Feb 11, 2014 at 22:00 UTC ( #1074525=perlquestion: print w/replies, xml ) Need Help??
mike_hi has asked for the wisdom of the Perl Monks concerning the following question:

Suppose my site url is Is there a way, when someone logs in to my site using (without the www) or usingt the IP to automatically change their url to without having to us an absolute URL. What is happening is that the login cookie gets lost when the various urls on the site change. So I'd like to make everyone start by being Can this be done through a form? Hope this makes sense. Thanks, Mike

Replies are listed 'Best First'.
Re: automatically converting a URL to www
by Your Mother (Chancellor) on Feb 11, 2014 at 23:23 UTC

    Since this is an entirely Perl-free question I’ll offer my free 2¢. …What?

    You’re doing it backwards. Shorter URLs are better. This isn’t 1998 and no one ever wants to have to say out loud, “double-u, double-u, double-u, dot.”

Re: automatically converting a URL to www
by jethro (Monsignor) on Feb 11, 2014 at 22:12 UTC

    Yes, (in case you run apache) the easiest way is to create a virtual host that redirects to the generic address. See for example for the simple recipe.

Re: automatically converting a URL to www
by choroba (Chancellor) on Feb 11, 2014 at 22:03 UTC
    What web server do you run?
    لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1074525]
Approved by GotToBTru
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2016-10-20 22:02 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (283 votes). Check out past polls.