473,387 Members | 1,669 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,387 software developers and data experts.

clean urls

I'm looking for a way to come up with clean urls like
http://www.mysite.com/products/233 instead of
http://www.mysite.com/products.php?pid=233 without having to rely on
mod_rewrite or other server-specific solutions.

any suggestions, links to articles etc?

thanks.

..soma
Jul 17 '05 #1
3 2056
*** somaboy mx wrote/escribió (Fri, 1 Jul 2005 11:08:55 +0200):
I'm looking for a way to come up with clean urls like
http://www.mysite.com/products/233 instead of
http://www.mysite.com/products.php?pid=233 without having to rely on
mod_rewrite or other server-specific solutions.

any suggestions, links to articles etc?


If you don't want your webserver to parse your URLs, then you must have
real files and directories (or at least symlinks, but of course these are
quite server-specific too).

A way to do so would be creating static files from a PHP script every time
your database contents are modified.
--
-- Álvaro G. Vicario - Burgos, Spain
-- http://bits.demogracia.com - Mi sitio sobre programación web
-- Don't e-mail me your questions, post them to the group
--
Jul 17 '05 #2
somaboy mx <no****@fakemail.fk> wrote:
I'm looking for a way to come up with clean urls like
http://www.mysite.com/products/233 instead of
http://www.mysite.com/products.php?pid=233 without having to rely on
mod_rewrite or other server-specific solutions.


You could be lucky and have the first URL working (if the second one
already works (depending on httpd configuration (Apache Multiview
IIRC))) and find 233 in _SERVER['PATH_INFO']. But that still depends on
platform. Alternatively you could build an intelligent 404 handler which
should work on all platforms supporting dynamic 404 handlers (which I
guess is most), but again platform dependend.

Most likely to work out of the box is http://www.mysite.com/products.php/233.

But I guess there is no single guaranteed multiplatform solution.

Jul 17 '05 #3
somaboy mx (no****@fakemail.fk) wrote:
: I'm looking for a way to come up with clean urls like
: http://www.mysite.com/products/233 instead of
: http://www.mysite.com/products.php?pid=233 without having to rely on
: mod_rewrite or other server-specific solutions.

: any suggestions, links to articles etc?

If this is apache then it works, you don't need to do anything, except get
the "products" to be known as a script.

The "unused" parts of the path will then be given to you by the
environment variable PATH_INFO

If you use the name "products.php" then it should work as-is.

http://www.mysite.com/products.php/more/stuff/goes/here

(PATH_INFO will contain "/more/stuff/goes/here")

If you really want to use "products" then you need to set something up so
force apache to recognize the script as being a php script. Normally
apache is configured to look for the ending ".php", but you can flag a
specific files for special handling, or an entire directory, by putting
the right rule in the conf file, or in the .htaccess file, though I
haven't done that for this task so I can't show you an example.
--

This space not for rent.
Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: phpkid | last post by:
Howdy I've been given conflicting answers about search engines picking up urls like: http://mysite.com/index.php?var1=1&var2=2&var3=3 Do search engines pick up these urls? I've been considering...
7
by: Creative Acceleration | last post by:
Hi all, I need to convert the Query Strings into Clean URLs, Found some articles on PHP and Apache server.. How do we it them with ASP ?? Thanks Kart
26
by: Howard Brazee | last post by:
I would like to click on a URL of a html document that will open several URLs at once for me. Does someone have an example of a html document that will do this?
1
by: DM | last post by:
I'm working on a site with more than 1700 HTML files. We'll be moving files around on this site a lot because we're reorganizing it. I'm thinking of writing a script that will convert all URLs in...
0
by: Sharon | last post by:
Hi all. How do i implement clean urls? Any help or article links are appreciated. Thanks, Sharon.
4
by: Jeeran | last post by:
We use an ISAPI filter to convert long urls into short clean ones. For example: "Site.com/user/john/" Is re-written as: "Site.com/user/userinfo.aspx?uid=john" Now, "userinfo.aspx" contains a...
3
by: WebCM | last post by:
How to apply nice URL-s into CMS? 1. Should we use nice urls for every page? 2. Do we need to put a FULL path into <a href="">? 3. What is faster and better? a) 10 rules in .htaccess...
3
by: d3vkit | last post by:
I've been using apache and php to create clean urls for a while, and suddenly the other day it just stopped working. My host is godaddy.com and I think this might be the source of my trouble, but...
8
by: raamay | last post by:
i have been trying a hell lot to achieve the task of cleaning my urls but has not been able to succed. I downloaded the example codes from...
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
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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.