PHP Classes

More About PHPClasses site

Recommend this page to a friend!

      PHP Classes blog  >  More defensive progra...  >  All threads  >  More About PHPClasses site  >  (Un) Subscribe thread alerts  
Subject:More About PHPClasses site
Summary:Some questions about PHPClasses
Messages:9
Author:Cesar D. Rodas
Date:2007-06-07 18:20:10
Update:2010-03-11 15:47:43
 

  1. More About PHPClasses site   Reply   Report abuse  
Picture of Cesar D. Rodas Cesar D. Rodas - 2007-06-07 21:51:19
Hello Mr. Lemos.

Great article. I think this is very important because the theory is a quite different from practice.

Right now I have some questions about your site mr. Lemos, and will be great if you can clean my doubts.

*http://www.phpclasses.org/dnserver
How do you manage this kind of redirections? with URL rewrites?.

* When you download some package I saw that the URL are like theses:
phpclasses.org/browse/download/targ ...
phpclasses.org/browse/download/zip/ ...

In the URls, are they real files, I mean are they really exist in the FS. example:
/var/www/html/browse/download/zip/package/3736/name/dnserver-2007-03-07.zip
Or are you using URL Rewrite redirecting to other location on FS
Or are you generating the file in real time with php (I think this is very bad for performance).

Resuming my big question is if you use or not URL rewrite?. Because I think the way of PHPClasses manage namespaces made it easy to crawl and easy of replicate.

Thank you.

Cesar D. Rodas

PD: Sorry if I have mistakes with my "English" in this post ;)

  2. Re: More About PHPClasses site   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2007-06-07 22:01:04 - In reply to message 2 from Cesar D. Rodas
The site uses Apache ErrorDocument to handle requests to pages that do not exist.

There is no page http://www.phpclasses.org/dnserver . The error handling script handles that request. It analyzes the REQUEST_URI environment variable and figures what page you want to access.

The site does not use mod_rewrite anywhere. Requests to URL like http://www.phpclasses.org/browse/download/targz/package/3736/name/dnserver-2007-03-07.tar.gz are handled by a PHP script named browse .

Apache is configured to treat the browse script as a PHP script. It analyzes the REQUEST_URI to extract parameters that determine the content that is going to be served.

  3. Re: More About PHPClasses site   Reply   Report abuse  
Picture of Wojciech Wojciech - 2008-11-05 15:57:30 - In reply to message 3 from Manuel Lemos
I just tought about doing the same thing for SEO friendly urls on the website Im doing, however I was wondering how bots will see this. When you use ErrorDocument 404 doesnt it mean the result will be 404 whatever the content is served ?

cheers

  4. Re: More About PHPClasses site   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2008-11-05 17:54:37 - In reply to message 4 from Wojciech
No, the script that handles the error page request determines the status code. So robots always see it as a normal page.

Anyway, if you have a PHP script named browse and configure Apache to treat it as PHP script like in the PHPClasses, requests to /browse/package/N.html will always be handled by browse script, not as a 404 error .

  5. Re: More About PHPClasses site   Reply   Report abuse  
Picture of Wojciech Wojciech - 2008-11-05 21:33:59 - In reply to message 5 from Manuel Lemos
thanks for your reply but Ive had so many problems with that hosting that its hard to say. Not only is rewrite engine disable and many php functions but I noticed that whatever I do it does result in 404 error using this method.

Ihave used index.php for my standard page and 404 handler. using header( location ... I tested header function to work and it did. But whenever script is used as 404 handler header function does not work so changing to 200 code is not possible there whatever you do - result : frendly urls with 404 respone :)

Had to change my system all way through.

People be aware of demon.net if you want to have friendly urls.

  6. Re: More About PHPClasses site   Reply   Report abuse  
Picture of zsolt szabo zsolt szabo - 2008-11-09 18:47:50 - In reply to message 2 from Cesar D. Rodas
Hi

First thank you for the excellent class.
I have one question ( well I am a graphic designer not a php guru )

Is it possible to get this class work withoult mod_rewrite?

This link:
index.php?page=about_us

to:
index.php/page/about_us

I fiddled a lot around but I could not get it to work.

The best thing I did was:
index.php/page/about_us

but after I clicket an another button my url was the following:
index.php/page/about_us/page/about_us/

if I clicked on another button:
index.php/page/about_us/page/about_us/page/about_us/page/about_us/

etc

CA you help me to get such a functionality ?

Thanks
Zsolt








  7. Re: More About PHPClasses site   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2008-11-09 18:56:19 - In reply to message 7 from zsolt szabo
You need to study Apache mod_rewrite configuration, which is something not really related with PHP.

Anyway, you do not need to rewrite URLs to make sites handle high traffic loads.

  8. Re: More About PHPClasses site   Reply   Report abuse  
Picture of Mohammed Huzaifa Mohammed Huzaifa - 2010-03-11 15:10:13 - In reply to message 8 from Manuel Lemos
Hi lemos

Great article Good Job

I was wondering Can i use this class to do URL-rewrite on a site hosted on Windows Server

Looking forward from you

Mohammed




  9. Re: More About PHPClasses site   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2010-03-11 15:47:43 - In reply to message 9 from Mohammed Huzaifa
I do not use a class for that. I just look at the $_SERVER['REQUEST_URI'] variable and split its parts.