View Full Version : PHP - Pass data as xyz.php/7272
trevHCS
13-12-2002, 05:16 PM
I've seen sites where instead of a site passing data as something.php?this=that they use: something.php/somepageid
For example, I just went to:
http://www.developer.com/xml/article.php/628371
...and it appears the number on the end is the page ID number as if you change it, the page changes so I'd guess they are passing data with that instead of ?628371
I once saw a thread on a Perl forum about it, but I was young (stop laughing Craig! :)) and foolish and so didn't write it down.
Does anyone know how you achieve this?
Oh and on the tiny off chance, does anyone know if its possible to pass more than one variable across?
Trev
I'd imagine this is done using mod_rewrite.
have a google for it :)
Andy
trevHCS
14-12-2002, 12:46 AM
I think I could get to like mod_rewrite! :)
Both problems sorted by it so now I can produce what appears to be an 1500 page site with around 5 HTML pages, 1 PHP script and the ever useful .htaccess file.
Oh and of course help from the Flump staff!
Cheers
Trev
I thought the other problem was solved by .htaccess not mod_rewrite?
trevHCS
14-12-2002, 01:13 AM
Yep, good point - I'd forgotten that I changed the way I was solving the problem.
The new one works along the lines:
.htaccess file
RewriteEngine on
RewriteBase /
RewriteRule ^hotels/(.*)\.htm$ /output/print.php\?id=$1
....which means the search engine sees something nice and friendly looking like www.url.com/hotels/hotel_name.htm instead of test.php?id=hotel_name
Search engine is happy as it thinks it has a static HTML file to read and I'm happy because I don't have to write code to update 1500 HTML files.
Trev
trevHCS
14-12-2002, 01:23 AM
Originally posted by Andy
sounds good :D
Yeah, except it means we won't be running out of disk space on the accounts and therefore won't require larger accounts which could result in your Xmas bonus being reduced.... :rolleyes:
(Well apart from the little problem that each HTML file would be about 10k anyway so might not exactly require a Plat. account, but....one day)
Trev
--
http://www.travelsurfing.com
Ah, but didn't you know my consultancy charges are 50GBP/hr - I believe Craig is knocking up a bill as I type ;)
chrisranjana
14-12-2002, 11:10 AM
or were they using $ENV["PATH_INFO"] ?
trevHCS
14-12-2002, 12:08 PM
Originally posted by chrisranjana
or were they using $ENV["PATH_INFO"] ?
I think you're right there for Developer.com
Found another page about this which quoted about 3 ways to do it using path_info, although only one of them wasn't a very bizare way to fix it.
In my case, I figured supplying fake .htm files to Google was a good way around it - just hope it can't see the redirection going on internally?
Cheers
Trev
--
http://www.aardvarksport.net
chrisranjana
18-12-2002, 09:17 AM
Actually now google has become little more intelligent and it has started ranking pages according to "True Relevance"
trevHCS
18-12-2002, 09:43 AM
Whats the difference between "true relevence" and the previous method they used?
I'm not attempting to boost the ranking as such by using this method, but just to give us more chance of not being knocked down after we've done all the promotion work, then Google comes along and thinks 'I can't spider something with
url.com/something.php?id=5&this=10 etc.. '
Thats the theory anyway... :)
Trev
--
http://www.aardvarktravel.net/
vBulletin® v3.6.8, Copyright ©2000-2010, Jelsoft Enterprises Ltd.