By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,446 Members | 3,120 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,446 IT Pros & Developers. It's quick & easy.

URL masking when using PHP sessions.

P: n/a
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

May 10 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
On Tue, 09 May 2006 14:11:31 -0700, ne**@celticbear.com wrote:
Anyway, is there some ways that the URL can be completely masked and yet
still allow sessions to work?


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

May 10 '06 #2

P: n/a

Andy Jeffries wrote:
On Tue, 09 May 2006 14:11:31 -0700, ne**@celticbear.com wrote:
Anyway, is there some ways that the URL can be completely masked and yet
still allow sessions to work?


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).


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

May 12 '06 #3

P: n/a

ne**@celticbear.com wrote:
Andy Jeffries wrote:
On Tue, 09 May 2006 14:11:31 -0700, ne**@celticbear.com wrote:
Anyway, is there some ways that the URL can be completely masked and yet
still allow sessions to work?


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).


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


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

May 12 '06 #4

P: n/a
On Fri, 12 May 2006 14:34:07 -0700, ne**@celticbear.com wrote:
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!! =)


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

May 14 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.