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

inclusion page in url

P: n/a
hello, I have a small doubt that I came while navigating a site
web, practically could see the other pages while
Having always a given page in url, I'll explain with a
example that is much clearer, www.site.it/homepage.php
displaying the front page of the site, but if I did www.site.it/homepage.php#/utenti.php
view list of users, I was wondering how I could
do such a thing in php? I raised this question? : D

thanks
Sep 17 '08 #1
Share this Question
Share on Google+
17 Replies


P: n/a
co*******@gmail.com wrote:
hello, I have a small doubt that I came while navigating a site
web, practically could see the other pages while
Having always a given page in url, I'll explain with a
example that is much clearer, www.site.it/homepage.php
displaying the front page of the site, but if I did www.site.it/homepage.php#/utenti.php
view list of users, I was wondering how I could
do such a thing in php? I raised this question? : D

thanks
You don't need PHP for this - it's straight html and possibly apache
configuration (mod_rewrite).

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Sep 17 '08 #2

P: n/a
On Tue, 16 Sep 2008 17:23:59 -0700, co*******@gmail.com wrote:
hello, I have a small doubt that I came while navigating a site web,
practically could see the other pages while Having always a given page
in url, I'll explain with a example that is much clearer,
www.site.it/homepage.php displaying the front page of the site, but if I
did www.site.it/homepage.php#/utenti.php view list of users, I was
wondering how I could do such a thing in php? I raised this question? :
D

thanks
Say you have the page http://nl.php.net/manual/en/index.php. A request to
http://nl.php.net/manual/en/index.php/any.file.name will also be served
by index.php. In this example, it does not change the page, but the PHP
file may parse the URL and decide to serve something else when the URL is
different.

Anybody knows what this feature is called or why this works like this?
Sep 17 '08 #3

P: n/a
r0g
Sjoerd wrote:
On Tue, 16 Sep 2008 17:23:59 -0700, co*******@gmail.com wrote:
>hello, I have a small doubt that I came while navigating a site web,
practically could see the other pages while Having always a given page
in url, I'll explain with a example that is much clearer,
www.site.it/homepage.php displaying the front page of the site, but if I
did www.site.it/homepage.php#/utenti.php view list of users, I was
wondering how I could do such a thing in php? I raised this question? :
D

thanks

Say you have the page http://nl.php.net/manual/en/index.php. A request to
http://nl.php.net/manual/en/index.php/any.file.name will also be served
by index.php. In this example, it does not change the page, but the PHP
file may parse the URL and decide to serve something else when the URL is
different.

Anybody knows what this feature is called or why this works like this?
Yes, as Jerry says above that's apache's mod_rewrite module.

It's a system that uses regular expressions to pattern match and convert
the URLs you receive in a GET requests into the URLs you actually want.

You specify rewrite directives in you apache config file OR (for
individual users) in htaccess files.

By rewriting the URLS you can change paths into variables e.g.

You receive http://www.poo.poo/images/badgers

and mod_rewrite could change that into:

http://www.poo.poo/imagescript.php?type=badgers

Thereby mapping paths to PHP scripts and variables.

The reference documentation is quite terrifying considering the simple
use cases most people have so I'm not sure I recommend reading and
regular expressions(regex) can take quite a while to get the hang of too
so be prepared to spend a few evenings mastering it! Some useful
examples can be found here:
http://httpd.apache.org/docs/1.3/misc/rewriteguide.html

Roger Heathcote.
Sep 17 '08 #4

P: n/a
On 17 Set, 02:53, Jerry Stuckle <jstuck...@attglobal.netwrote:
cobra9...@gmail.com wrote:
hello, I have a small doubt that I came while navigating a site
web, practically could see the other pages while
Having always a given page in url, I'll explain with a
example that is much clearer,www.site.it/homepage.php
displaying the front page of the site, but if I didwww.site.it/homepage.php#/utenti.php
view list of users, I was wondering how I could
do such a thing in php? I raised this question? : D
thanks

You don't need PHP for this - it's straight html and possibly apache
configuration (mod_rewrite).

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================
ok thanks to all :)
Sep 17 '08 #5

P: n/a
On Wed, 17 Sep 2008 10:43:02 -0400, Jerry Stuckle wrote:
>>>you have the page http://nl.php.net/manual/en/index.php. A request
to http://nl.php.net/manual/en/index.php/any.file.namewill also be
served by index.php.
Check again. mod_rewrite needs to be involved. Otherwise your script
will never get control - the user will get a 404 Not Found instead.
Not in my experience. The server seems to redirect requests to a "subdir"
of the PHP file to the PHP file itself.

Appearantly, this works not only on my server but on other servers too:
http://nl.php.net/manual/en/index.php/any.file.name
http://www.friendster.com/widgetdire.../any.file.name
http://www.colemaninstitute.org/over.../any-file-name

Here, I appended any-file-name, but that gives the same page as without
it and not a 404 Not Found.

Besides, www.colemaninstitute.org seems to be running IIS.
Sep 17 '08 #6

P: n/a
Sjoerd wrote:
On Wed, 17 Sep 2008 10:43:02 -0400, Jerry Stuckle wrote:
>>>>you have the page http://nl.php.net/manual/en/index.php. A request
to http://nl.php.net/manual/en/index.php/any.file.namewill also be
served by index.php.
Check again. mod_rewrite needs to be involved. Otherwise your script
will never get control - the user will get a 404 Not Found instead.

Not in my experience. The server seems to redirect requests to a "subdir"
of the PHP file to the PHP file itself.

Appearantly, this works not only on my server but on other servers too:
http://nl.php.net/manual/en/index.php/any.file.name
http://www.friendster.com/widgetdire.../any.file.name
http://www.colemaninstitute.org/over.../any-file-name

Here, I appended any-file-name, but that gives the same page as without
it and not a 404 Not Found.

Besides, www.colemaninstitute.org seems to be running IIS.
Then the server is set up to serve that page instead of a 404 Not Found.

Not really a good idea, IMHO.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Sep 17 '08 #7

P: n/a
r0g <ai******@technicalbloke.comwrites:
Actually he's right, although it sounds like mod rewrite I just tried:

http://www.php.net/downloads.php/test

and it served up exactly the same page as:

http://www.php.net/downloads.php

How odd.
Nothing odd about it at all. PATH_INFO has been around for as long as
CGI scripts have been.
I'm guessing it's a PHP/apache thing
No, PATH_INFO predates both PHP and Apache.
Would be interested to see if it works the same was on IIS though.
PATH_INFO works the same way on any standards-compliant server.

sherm--

--
My blog: http://shermspace.blogspot.com
Cocoa programming in Perl: http://camelbones.sourceforge.net
Sep 17 '08 #8

P: n/a
r0g
Sherm Pendley wrote:
r0g <ai******@technicalbloke.comwrites:
>Actually he's right, although it sounds like mod rewrite I just tried:

http://www.php.net/downloads.php/test

and it served up exactly the same page as:

http://www.php.net/downloads.php

How odd.

Nothing odd about it at all. PATH_INFO has been around for as long as
CGI scripts have been.
>I'm guessing it's a PHP/apache thing

No, PATH_INFO predates both PHP and Apache.
So this behaviour happens even on apache without PHP then??

Roger.
Sep 17 '08 #9

P: n/a
r0g <ai******@technicalbloke.comwrites:
Sherm Pendley wrote:
>r0g <ai******@technicalbloke.comwrites:
>>Actually he's right, although it sounds like mod rewrite I just tried:

http://www.php.net/downloads.php/test

and it served up exactly the same page as:

http://www.php.net/downloads.php

How odd.

Nothing odd about it at all. PATH_INFO has been around for as long as
CGI scripts have been.
>>I'm guessing it's a PHP/apache thing

No, PATH_INFO predates both PHP and Apache.

So this behaviour happens even on apache without PHP then??
Yes, of course. PATH_INFO is a standard CGI variable, available on any
server in any language:

<http://hoohoo.ncsa.uiuc.edu/cgi/env.html>

sherm--

--
My blog: http://shermspace.blogspot.com
Cocoa programming in Perl: http://camelbones.sourceforge.net
Sep 17 '08 #10

P: n/a
r0g
Sherm Pendley wrote:
r0g <ai******@technicalbloke.comwrites:
>Sherm Pendley wrote:
>>r0g <ai******@technicalbloke.comwrites:

Actually he's right, although it sounds like mod rewrite I just tried:

http://www.php.net/downloads.php/test

and it served up exactly the same page as:

http://www.php.net/downloads.php

How odd.
Nothing odd about it at all. PATH_INFO has been around for as long as
CGI scripts have been.

I'm guessing it's a PHP/apache thing
No, PATH_INFO predates both PHP and Apache.
So this behaviour happens even on apache without PHP then??

Yes, of course. PATH_INFO is a standard CGI variable, available on any
server in any language:

<http://hoohoo.ncsa.uiuc.edu/cgi/env.html>

sherm--
"These environment variables are set when the server executes the
gateway program."

So, to clarify, when you have any scripting/CGI invoked by the URL the
server will eat the rest of the URL and give it to the script/CGI in
this PATH_INFO variable.

When it doesn't (i.e. plain .html files) it'll just throw a 404.

Is this correct?

Sorry if I sound naive but I want to make sure I'm understanding this
properly.

BTW: When I said 'apache without PHP' what I meant was 'apache with no
scripting running, CGI or otherwise'. My bad. I guess I should have been
clearer about that.

Thanks for the insight,

Roger.
Sep 17 '08 #11

P: n/a
r0g <ai******@technicalbloke.comwrites:
Sherm Pendley wrote:
>r0g <ai******@technicalbloke.comwrites:
>>So this behaviour happens even on apache without PHP then??

Yes, of course. PATH_INFO is a standard CGI variable, available on any
server in any language:

<http://hoohoo.ncsa.uiuc.edu/cgi/env.html>

"These environment variables are set when the server executes the
gateway program."

So, to clarify, when you have any scripting/CGI invoked by the URL the
server will eat the rest of the URL and give it to the script/CGI in
this PATH_INFO variable.
Yes, exactly. Suppose you have a URL like this:

<http://foo.invalid/index.php/bar/baz/qux>

Now, supposing your base HTML directory is /home/html, when index.php
is executed the value of PATH_INFO will be '/bar/baz/qux', and that of
PATH_TRANSLATED will be '/home/html/bar/baz/qux'.
When it doesn't (i.e. plain .html files) it'll just throw a 404.

Is this correct?
Right. CGI variables aren't passed to static content, because there
would be no point in doing so - static content, by definition, would
not be able to use them anyway.

sherm--

--
My blog: http://shermspace.blogspot.com
Cocoa programming in Perl: http://camelbones.sourceforge.net
Sep 17 '08 #12

P: n/a
On 17 Set, 02:53, Jerry Stuckle <jstuck...@attglobal.netwrote:
cobra9...@gmail.com wrote:
hello, I have a small doubt that I came while navigating a site
web, practically could see the other pages while
Having always a given page in url, I'll explain with a
example that is much clearer,www.site.it/homepage.php
displaying the front page of the site, but if I didwww.site.it/homepage.php#/utenti.php
view list of users, I was wondering how I could
do such a thing in php? I raised this question? : D
thanks

You don't need PHP for this - it's straight html and possibly apache
configuration (mod_rewrite).

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================
but i have other request, how to i usa a char # in file htacces if is
comment ?

example on really site:

http://www.new.facebook.com/home.php

http://www.new.facebook.com/home.php#/notifications.php

ecc . . .

cobra90nj
Sep 18 '08 #13

P: n/a
On 17 Set, 02:53, Jerry Stuckle <jstuck...@attglobal.netwrote:
cobra9...@gmail.com wrote:
hello, I have a small doubt that I came while navigating a site
web, practically could see the other pages while
Having always a given page in url, I'll explain with a
example that is much clearer,www.site.it/homepage.php
displaying the front page of the site, but if I didwww.site.it/homepage.php#/utenti.php
view list of users, I was wondering how I could
do such a thing in php? I raised this question? : D
thanks

You don't need PHP for this - it's straight html and possibly apache
configuration (mod_rewrite).

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================
but i have other request, how to i use a char # in file htacces if is
comment ?

example on really site:

http://www.new.facebook.com/home.php

http://www.new.facebook.com/home.php#/notifications.php

ecc . . .

cobra90nj
Sep 18 '08 #14

P: n/a
co*******@gmail.com wrote:
On 17 Set, 02:53, Jerry Stuckle <jstuck...@attglobal.netwrote:
>cobra9...@gmail.com wrote:
>>hello, I have a small doubt that I came while navigating a site
web, practically could see the other pages while
Having always a given page in url, I'll explain with a
example that is much clearer,www.site.it/homepage.php
displaying the front page of the site, but if I didwww.site.it/homepage.php#/utenti.php
view list of users, I was wondering how I could
do such a thing in php? I raised this question? : D
thanks
You don't need PHP for this - it's straight html and possibly apache
configuration (mod_rewrite).

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================

but i have other request, how to i usa a char # in file htacces if is
comment ?

example on really site:

http://www.new.facebook.com/home.php

http://www.new.facebook.com/home.php#/notifications.php

ecc . . .

cobra90nj
Try alt.apache.configuration. This is NOT a PHP question.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Sep 18 '08 #15

P: n/a
..oO(co*******@gmail.com)
>but i have other request, how to i usa a char # in file htacces if is
comment ?
The # separates the URL from the fragment identifier. The server will
never see it. If you want that char to appear in your URLs, you have to
encode it.
>example on really site:

http://www.new.facebook.com/home.php

http://www.new.facebook.com/home.php#/notifications.php
Technically it's the same URL. The latter just contains a (invalid)
fragment identifier, which is handled by the browser.

Micha
Sep 18 '08 #16

P: n/a
Michael Fesser:
http://www.new.facebook.com/home.php
http://www.new.facebook.com/home.php#/notifications.php

Technically it's the same URL. The latter just contains a (invalid)
fragment identifier, which is handled by the browser.
RFC 3986 allows the fragment identifier </notifications.phpand HTML
allows the (a element) name attribute value "/
notifications.php" (although the same value for the id attribute would
be invalid).

--
Jock
Sep 18 '08 #17

P: n/a
..oO(John Dunlop)
>Michael Fesser:
>http://www.new.facebook.com/home.php
>http://www.new.facebook.com/home.php#/notifications.php

Technically it's the same URL. The latter just contains a (invalid)
fragment identifier, which is handled by the browser.

RFC 3986 allows the fragment identifier </notifications.phpand HTML
allows the (a element) name attribute value "/
notifications.php" (although the same value for the id attribute would
be invalid).
Yes. See my reply in the other thread about the names on form controls.
Same thing.

Micha
Sep 19 '08 #18

This discussion thread is closed

Replies have been disabled for this discussion.