?
Solved

A web page without extension (e.g. http://php.net/array )

Posted on 2006-06-14
7
Medium Priority
?
881 Views
Last Modified: 2008-01-09
In some URLs, there is not extension to the "file" -- For example:
http://au2.php.net/array
http://en.wikipedia.org/wiki/Prokaryotes

Initially I thought they are Directories and there is an index.xxx inside the directories.... but I have tried index.php/asp/jsp/htm/html and they actually do not exist (in the two examples above)

so...what are they?? is "array" a file without an extension or what? If so, how can a web server process files without an extension?
0
Comment
Question by:jtjli
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 3

Expert Comment

by:jeaton32
ID: 16908488
Here's a clip I found from the W3C's website on URI's: http://www.w3.org/Provider/Style/URI.html

How can I remove the file extensions...

...from my URIs in a practical file-based web server?

If you are using, for example, Apache, you can set it up to do content negotiation. You keep the file extension (such as .png) on the file (e.g. mydog.png), but refer to the web resource without it. Apache then checks the directory for all files with that name and any extension, and it can also pick the best one out of a set (e.g. GIF and PNG). (You do not have to put different types of file in different directories, in fact the content negotiation won't work if you do.)

    * Set up your server to do content negotiation
    * Make references always to the URI without the extension

References which do have the extension on will still work but will not allow your server to select the best of currently available and future formats.

(In fact, mydog, mydog.png and mydog.gif are each valid web resources. mydog is content-type-generic. mydog.png and mydog.gif are content-type-specific.)

Of course, if you are building your own server, then using a database to relate persistent identifiers to their current form is a very clean idea -- though beware the unbounded growth of your database.
0
 
LVL 3

Expert Comment

by:jeaton32
ID: 16908495
jtjli,

Here's another link that looks a little more comprehensive:

http://www.websiteoptimization.com/speed/tweak/rewrite/

This article covers apache and IIS.
0
 
LVL 16

Accepted Solution

by:
OliWarner earned 1200 total points
ID: 16908995
Yes its called URL rewriting... A URL shouldn't define what the data is so extensions are really quite useless on a practical level, especially when they just jumble up the URL with unneeded data.

I use URL Rewriting on my site to do a similar thing
http://www.thepcspy.com/articles/networking/browser_speed_comparisons

URL Rewriting pass everything after "http://www.thepcspy.com" into my index.aspx file as a querystring so the actual request is something like this:
http://www.thepcspy.com/index.aspx?page=/articles/networking/browser_speed_comparisons

I have built a pagehandler to read the querystring and decide what data needs to be displayed from there on...

For example it sees that it starts with /articles so hands it off to the article handler which then reads the section information "networking" and the cleaned up title "browser_speed_comparisons" and goes off to the database looking for the correct article and displays it.

That's a pretty complex example of URL Rewriting... You can use it just for one-off rewrites like a request for /page1.htm actually rewriting to the output of page1.asp

PHP will be using a system a bit like mine... perhaps not with the multiple handlers in the middle.


jeaton32 's link has some practical information on how to implement it in Apache. If you're using ASP.net v2 (like me) I suggest using URLRewriting.net
0
Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

 
LVL 44

Expert Comment

by:scrathcyboy
ID: 16909086
For a URL like -- http://au2.php.net/array
what that really means is, there is some file in the "array" directory that is the "default" file for that dir.

There is a general heirarcy to observe, and it is usually in this sequence, 1 is first, 2 is next, 3 third, etc.
1.  array/index.html
2.  array/index.htm
3.  array/index.shtml
4.  array/index.php
5.  array/index.asp

SO there are many possibiliites, but there is a *default* file for each directory, like array.

What defines which file will be the default is the .htaccess file on each site.  Any person can code their .htaccess file to make the default file whatever they want it to be -- you as an outsider cannot discover this of your own accord, since the .htaccess file is hidden -- it is up to the site owner to decide that.

Read up on .htaccess files on the internet.  They are extremely powerful files to redirect web sites.
0
 
LVL 18

Assisted Solution

by:carl_legere
carl_legere earned 200 total points
ID: 16910733
in php anything is possible, many servers are tweaked to hide the real path (because it is virtial anyway) from the end users.  A quick check of this site http://au2.php.net/array with Efftech's http sniffer reveals that the requestor requested http://au2.php.net/array with HTTP GET and the reply has no real name.  I beleive that you are assumed to be english speaking and it uses the php code backend located at http://au2.php.net/manual/en/ref.array.php to render the page.

The clever redirects here aren't to protect these wiki's since I was able to download the whole thing with Teleport, but just makes it more organized to them.
0
 
LVL 8

Assisted Solution

by:netmunky
netmunky earned 600 total points
ID: 16912072
most often this is all done with apache mod_rewrite

for example, if you see
http://www.example.com/news/2523/this-guy-did-that-thing
and
http://www.example.com/news/2523/this-guy-did-that-thing/comments

you might see this in the apache config (.htaccess or httpd.conf)
RewriteEngine On
RewriteCond %{THE_REQUEST} \ /news/([0-9]+)/.*/comments
RewriteRule .  /news.php?act=showcomments&id=%1
RewriteCond %{THE_REQUEST} \ /news/([0-9]+)/.*
RewriteRule .  /news.php?act=shownews&id=%1

anything that matches the part of the regular expression ([0-9]+) is put in place of %1, so you will actually be visiting
http://www.example.com/news.php?act=shownews&id=2523
and
http://www.example.com/news.php?act=showcomments&id=2523

mod_rewrite is to make URLs more reader friendly, but mostly because it can boost your rankings in search engines having the keywords in there ("this-guy-did-that-thing", if someone searches for "this guy")
0
 
LVL 4

Expert Comment

by:ansh_gupta
ID: 16912169
Basically we have something called wild card mapping in webservers. I will talk about IIS 6.0. We can have a programm on the server to process the request first then any other thing when any comes to a webserver.. So that programm knows about what to add to the request. Its just kind of security feature which hides the extensions and the special program set to process the requests will know how to handle that.  Its really normal..
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
This article was originally published on Monitis Blog, you can check it here . Today it’s fairly well known that high-performing websites and applications bring in more visitors, higher SEO, and ultimately more sales. By the same token, downtime…
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question