473,748 Members | 9,933 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2080
*** 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****@fakemai l.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****@fakemai l.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.p hp" 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
3423
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 converting a site of mine to PHP-Nuke, but if the individual modules aren't picked up in search engines I'm not going to do it. Thanks phpKid
7
4399
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
12569
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
1819
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 href and src attributes to absolute URLs with this form: href="/somedir/somefile.htm" src="/images/somecategory/image.gif" That way, if you move a page from one directory to another, the links and image references within the page will not...
0
1002
by: Sharon | last post by:
Hi all. How do i implement clean urls? Any help or article links are appreciated. Thanks, Sharon.
4
1909
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 web user control which uses some Atlas functionality; The web user control contains a "DataList" which gets updated asynchronously through Atlas when the user clicks a button –the button is the Atlas trigger.
3
3872
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 which redirect you to normal URLs with GET parameters
3
3929
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 I'm not sure what exactly that trouble is. Here is my .htaccess file: AddHandler x-httpd-php5 .php AddHandler x-httpd-php .php4 <FilesMatch "^comic$|^post$|^characters$|^extras$"> ForceType application/x-httpd-php </FilesMatch> I have a...
8
2906
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 http://www.lucabiagini.com/2008/03/php-mysql-htaccess-friendly-urls/ in order to understand the way and tried it in my machine. But even this example do not work in my machine. Do not work in the sense that when i click on an archive entry i am directed to the url http://localhost/ex/single.php?id=1. This...
0
8991
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9548
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9374
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9249
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6796
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6076
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4607
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2787
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.