473,386 Members | 1,710 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

inclusion page in url

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
17 1903
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
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
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
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
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
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
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
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
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
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
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
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
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
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
..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
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
..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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

51
by: Reinhold Birkenfeld | last post by:
Hello, at the moment python-dev is discussing including Jason Orendorff's path module into the standard library. Do you have any other good and valued Python modules that you would think are...
8
by: qazmlp | last post by:
I need to include a list of - C++ headers - headers of other modules - headers of my module - implementation specific ie.OS headers In what order, they should be included in my .CPP file?...
16
by: Nathan Funk | last post by:
I used to work as a web designer a couple of years ago, but I haven't been closely in touch in the past years. Has anything changed recently for managing content that is common among many pages...
5
by: Dave | last post by:
Hello all, To protect against multiple inclusions, it is standard practice to enclose the contents of a header file in a construct like this: #ifndef FOO_INCLUDED #define FOO_INCLUDED .......
6
by: techBoy | last post by:
I am looking for a tool that can scan my soyrce code and check if a header file gets included more then once in a sequece of compiled code. Can some one guide me to such a tool !!
4
by: venkatbo | last post by:
Hi folks, I'd like to disable the inclusion of tk graphics lib in my py build. Looked around but couldn't find a clear answer. Which one of the following would I need to use in the configure...
6
by: vsgdp | last post by:
I was looking at some library code today and noticed something like this: // sublibrary.h // define some constants, enums, symbols #include "componentA.h" #include "componentB.h" #include...
6
by: Juha Nieminen | last post by:
Multiple inclusion of the same header file can cause the compilation to fail because of multiple definitions of the same type. That's why it's standard practice to write all headers like this: ...
1
by: RajinCodingForum | last post by:
I have some idea but i am puzzled. As i understand, file inclusion problems like x includes y and y in turn includes x etc. can be avoided by #ifdef preprocessor checks. Can you please explain with...
4
by: =?Utf-8?B?UmljaEI=?= | last post by:
I am trying to create a project using the ASP.NET AJAX accordion control. I would like to dynamically add panes to the control with a form template added when the pane is added. I have tried...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.