Click to See Complete Forum and Search --> : Links with no extension name in the end?


smith.norton
09-03-2006, 01:05 AM
I have seen many sites where the links are like,

http://www.example.com/advisories/1
http://www.example.com/advisories/2

and so on...

Or take this example, http://www.securityfocus.com/brief/293

Are they links to folders 1, 2, 293, etc.? Do they create folder for each and every page they create?

Isn't it difficult to manage if there are so many folders with just one file in them. Can anyone clarify these points?

If they aren't folders, how can I manage it? Basically, I don't want to display and extension names, I want the links to materials in my site similar to those links.

I would be thankful for any guidance you can provide.

pcthug
09-03-2006, 01:17 AM
This would be done with mod_rewrite. Taking your example (securityfocus), they may have an index.php file that processes an id from the query string:

http://www.securityfocus.com/index.php?id=293
To allow for the directory style URI rewriting they would put a htaccess file in there root directory (the one with the index.php file in it) with the following code:
RewriteEngine on
RewriteRule brief/^([^/\.]+)/?$ index.php?id=$1 [L]
Provided all goes well, when a visitor visits the rewritten URL (http://www.securityfocus.com/brief/293) they should be redirected to the actual URL (http://www.securityfocus.com/index.php?id=293) whilst maintaining the rewritten URL.

smith.norton
09-03-2006, 01:56 AM
The problem with Windows systems is that I can't create .htaccess file in Windows. I can't manually create a file beginning with dot (.) in Windows. So what should I do?

pcthug
09-03-2006, 02:02 AM
Yes you can, open up notepad, paste in the previously posted code, navigate to File > Save As..., Change Save as type: to All Files, Change File name: to .htaccess and upload to your server. The the only problem may be that your not running an Apache server without the mod_rewrite module loaded.

LiLcRaZyFuZzY
09-03-2006, 02:54 AM
alternatively you can save it as text file, upload it to your server and change the name there

ronverdonk
09-03-2006, 05:29 AM
Well, now I am here, I might as well ask the question. My server is running the Windows Server. So is there a way that I can use this mod-rewrite or something similar on a Windows server? Or can you point me to some documentation on this? Thanks in advance.

Ronald :cool:

pcthug
09-03-2006, 05:34 AM
There are a few commercial ISAPI modules that I found:
ISAPI ReWrite (http://www.isapirewrite.com/)
IIS Rewrite (http://www.qwerksoft.com/products/iisrewrite/)
Mod Rewrite for IIS (http://www.iismods.com/url-rewrite/index.htm)

ronverdonk
09-03-2006, 05:47 AM
Thanks for this tip!

Ronald :cool:

bokeh
09-03-2006, 08:37 AM
Although this is possible to do with .htaccess it would be a really pain in the neck.

Dealing with omitted extensions is a default behaviour of mod_negociate.

Make a phpinfo() file to find the details of the server you are using.