Connecting Tech Pros Worldwide Forums | Help | Site Map

URL masking when using PHP sessions.

news@celticbear.com
Guest
 
Posts: n/a
#1: May 10 '06
We have a huge PHP e-commerce site that relies totally on PHP sessions
and cookies.
We need to create a demo version of the site for potential clients to
use that does NOT show the original URL in the browser, but we can't
just simply copy the site and database over to to a new URL.

My first thought was to set up a site at the new URL and then include
the PHP site in a frame... but the PHP sessions prevent us from doing
this.

I'm inheriting this site, so I don't really know how the PHP sessions
work to well, but from what I've read about sessions, frames is nearly
impossible from the way the site is set up. But I don't know enough
about PHP sessions to know what kind of questions to ask.

Anyway, is there some ways that the URL can be completely masked and
yet still allow sessions to work?

Thanks for any pointers or direction!
Liam


Andy Jeffries
Guest
 
Posts: n/a
#2: May 10 '06

re: URL masking when using PHP sessions.


On Tue, 09 May 2006 14:11:31 -0700, news@celticbear.com wrote:[color=blue]
> Anyway, is there some ways that the URL can be completely masked and yet
> still allow sessions to work?[/color]

Look at using mod_rewrite with [P] for proxying.

Something like (but this is going from memory):

<VirtualHost *>
ServerName www.demodomainname.com
RewriteEngine on
RewriteRule /(.*) http://www.livedomainname.com/$1 [P]
</VirtualHost>

As I said, that's going from memory but it'll be something like that. I
used to use it when moving sites from one server to another (so you can
move a site even if you don't have the ability/access/time to set the DNS
to be on a quick TTL).

Cheers,


Andy

--
Andy Jeffries MBCS CITP ZCE | gPHPEdit Lead Developer
http://www.gphpedit.org | PHP editor for Gnome 2
http://www.andyjeffries.co.uk | Personal site and photos

news@celticbear.com
Guest
 
Posts: n/a
#3: May 12 '06

re: URL masking when using PHP sessions.



Andy Jeffries wrote:[color=blue]
> On Tue, 09 May 2006 14:11:31 -0700, news@celticbear.com wrote:[color=green]
> > Anyway, is there some ways that the URL can be completely masked and yet
> > still allow sessions to work?[/color]
>
> Look at using mod_rewrite with [P] for proxying.
>
> Something like (but this is going from memory):
>
> <VirtualHost *>
> ServerName www.demodomainname.com
> RewriteEngine on
> RewriteRule /(.*) http://www.livedomainname.com/$1 [P]
> </VirtualHost>
>
> As I said, that's going from memory but it'll be something like that. I
> used to use it when moving sites from one server to another (so you can
> move a site even if you don't have the ability/access/time to set the DNS
> to be on a quick TTL).
>[/color]

Ah man, that was a great idea. But, not quite, but I might be missing
something.
After doing that, I go to http://www.demodomainname.com and it does
indeed show the content for www.livedomainname.com while keeping the
URL http://www.demodomainname.com!

But if I go to any link on there, it changes the URL to
hhttp://www.livedomainname.com/pagename.php.
I'm searching the concept of RewriteRule, but I can't seem to find
anything that keeps the URL the original domain name.

Any ideas?
Thanks for the idea!!
-Liam

news@celticbear.com
Guest
 
Posts: n/a
#4: May 12 '06

re: URL masking when using PHP sessions.



news@celticbear.com wrote:[color=blue]
> Andy Jeffries wrote:[color=green]
> > On Tue, 09 May 2006 14:11:31 -0700, news@celticbear.com wrote:[color=darkred]
> > > Anyway, is there some ways that the URL can be completely masked and yet
> > > still allow sessions to work?[/color]
> >
> > Look at using mod_rewrite with [P] for proxying.
> >
> > Something like (but this is going from memory):
> >
> > <VirtualHost *>
> > ServerName www.demodomainname.com
> > RewriteEngine on
> > RewriteRule /(.*) http://www.livedomainname.com/$1 [P]
> > </VirtualHost>
> >
> > As I said, that's going from memory but it'll be something like that. I
> > used to use it when moving sites from one server to another (so you can
> > move a site even if you don't have the ability/access/time to set the DNS
> > to be on a quick TTL).
> >[/color]
>
> Ah man, that was a great idea. But, not quite, but I might be missing
> something.
> After doing that, I go to http://www.demodomainname.com and it does
> indeed show the content for www.livedomainname.com while keeping the
> URL http://www.demodomainname.com!
>
> But if I go to any link on there, it changes the URL to
> hhttp://www.livedomainname.com/pagename.php.
> I'm searching the concept of RewriteRule, but I can't seem to find
> anything that keeps the URL the original domain name.
>
> Any ideas?
> Thanks for the idea!!
> -Liam[/color]

OK, ignore this.
Closer examination shows the links in www.livedomainname.com are hard
links
e.g.: a href="http://www.livedomainname.com/page.php"
and are not relative
e.g.: a href="page.php"

When I change the links to relative links it continues to work fine.
Thanks!! =)
-Liam

Andy Jeffries
Guest
 
Posts: n/a
#5: May 14 '06

re: URL masking when using PHP sessions.


On Fri, 12 May 2006 14:34:07 -0700, news@celticbear.com wrote:[color=blue]
> OK, ignore this.
> Closer examination shows the links in www.livedomainname.com are hard
> links
> e.g.: a href="http://www.livedomainname.com/page.php" and are not relative
> e.g.: a href="page.php"
>
> When I change the links to relative links it continues to work fine.
> Thanks!! =)[/color]

Cool, glad I could help in pointing you in the right direction.

Cheers,


Andy

--
Andy Jeffries MBCS CITP ZCE | gPHPEdit Lead Developer
http://www.gphpedit.org | PHP editor for Gnome 2
http://www.andyjeffries.co.uk | Personal site and photos

Closed Thread


Similar PHP bytes