SEO friendly URLs in the form of http://HOST/index.php/yada/ |
Site Admin
|
although mod_rewrite is supported by Apache servers only, you can try to use phpdock's fail-safe feature in order to get index.php executed.
If you open phpdock.ini, you'll find [ErrorHandlers] and a handler for 404 error in particular. Try to replace it with your version of index.php. |
||||||||||||
_________________ The PHP IDE team |
|
Hey dmitri, Very, very close. This does what you expect. If you would provide me a very simple variable (such as ${HTTPClient:QueryString}) my problem would be solved. I believe you could provide this variable simply by pulling ${HTTPClient:InitialUrl} from the ini file and removing that string from the URI requested. Place that into something we can use as ${HTTPClient:QueryString} and I think we have a simple emulation. I would then able to use the fail safe thus: 404=../web/index.php${HTTPClient:QueryString} While this is a hack, it is simple for you and solves my problem. Is this an acceptable solution for you? Thanks for your consideration. By the way... I'll be leading a PHP training seminar soon and you know I always mention your products. I've not been keeping up with new features on the way. Can you send me an e-mail highlighting some features on the way for your entire line so I can mention these things during my training event? Thanks, randy <remove> @randycasburn.com Randy |
||||||||||||||
|
|
I need something like this too for use in combination with Zend_Framework. Would it be possible to either integrate mod_rewrite or PATHINFO?
|
||||||||||||
|
|
Hi Tim, (think I've seen your name around) Just my opinion here, but I think it unreasonable for us to ask NuSphere to integrate something apache specific. But I have my reasoning I'll disclose in a sec. We already have separation of the path prior up to index.php since we must provide that in the PhpDock.ini file. The only thing we need is the string, in raw form, after that PhpDock.ini file entry for the ${HTTPClient:InitialUrl}. Then, I'm not certain, but I think we developers can do what we need to emulate platform specific "PATHINFO" like capabilities. Would you agree that this would satisfy your needs? Now, here's why I would rather not just throw this over the fence at Dmitri and his small team. I am very interested in seeing a couple key enhancements come from NuSphere. If we have their small team tied up with fringe developments that are not aimed at the core product, it may become a distraction. But this is IMHO. FYI The relevant enhancement for this discussion is a PhpDock for BSD but more specifically for MAC. I need to deploy my applications on MACs just as simply as I do on Windows. I would say Linux as well, but I realize that poses greater challenges and frankly my desktop users are not using Linux. The nerds and geeks and toy makers might be, but the true application users that I am writing business applications for are using Windows and Macs. I need PhpDoc for for both platforms. Just sayin... Randy |
||||||||||||||
|
Site Admin
|
Randy, info is already provided in three env variables ERROR_FILE, ERROR_DOCUMENT, ERROR_CODE It's not necessary to be file-not-found error (404). If you have a script that returns 404 or any other http status code >= 400, you can trap and overwrite that with ErrorHandler. |
||||||||||||||
_________________ The PHP IDE team |
|
Of course - that's why you are the master Dmitri. Thanks for opening my eyes once again. I'll provide this script. You and NuSphere are welcome to change, distribute, and do with what you will. It needs some testing as I've not done any. But I think this captures the essence of what you are talking about. One note - you'll need to add an error handler called something like real404 to the ini. This is simply used by the script as a storage location for the actual 404 error redirection if your framework doesn't handle it for you. I've been busy packing for a weekend scouting campout with my son. Haven't taken the time to test this. Tim, perhaps you can use this? Test too? Randy
|
||||||||||||||||||
|
Site Admin
|
Great work, Randy.
I'm just trying to understand why would you need to store rewrite-settings in phpdock.ini? If you stored them in your module, you'd save some good time slice spent for ini-parsing. All values like $aDockSettings[HTTPServer][Listen] can be found in $_SERVER, so ini isn't needed for this. Right? And honestly, I'd avoid such constructs as $first_part = substr(..,...,strripos(...)+1) ; What if strripos does not find the subsubstring? A kind of error handling would make your script even better Finally, I see rewrite_url() function but seems it's not called... Could you please provide a real-world demo with instructions? |
||||||||||||
_________________ The PHP IDE team |
|
Back from the campout in the woods and wanted to address you point very quickly before I can spend any time on this... 'Never called rewrite_url()' - right. I don't need it for my purposes, but I thought Tim (the other poster) or maybe you other clients my find it useful to have a method they could use to rewrite their own URLs in a manner somewhat similar to the Apache does. So I through it together just to be nice The "DefaultDocument" setting is retrieved from PhpDock.ini -- everything else can be retrieved from $_SERVER. Does PhpDock set the DefaultDocument into $_SERVER? Didn't recognize that. If so, I'll refactor that in. Next the $first_part, $second_part, yada bits were only left in for instructional purposes. I would ordinarily comment the purpose and they would be gone. IRT strristr - OK - when I considered this, I my thought was "boy, when this error happens, there are bigger problems than can be solved here, because they have a malformed default URI". But I suppose the least I can do is shoot back the entire string rather than just one character of if it doesn't have any ':'s. I'll change the substr offset parameter to something along the lines of ( (needle === found?) ? needlePos : fullLen ; ) |
||||||||||||||
|
Site Admin
|
What's about redirection? For example from http://localhost/ to http://computername/ I think that once it's called as error handler, it should fallback to original error code or better redirecto to pre-defined page supposed to handle the error. |
||||||||||||||
_________________ The PHP IDE team |
|
I am verry much agreed with dmitri's openion.
|
||||||||||||
Last edited by clungtech on Tue Jan 20, 2009 8:02 am; edited 1 time in total |
|
I'll try to get some time to work on this today. |
||||||||||||||
|
SEO friendly URLs in the form of http://HOST/index.php/yada/ |
|
||
Content © NuSphere Corp., PHP IDE team
Powered by phpBB © phpBB Group, Design by phpBBStyles.com | Styles Database.
Powered by
Powered by phpBB © phpBB Group, Design by phpBBStyles.com | Styles Database.
Powered by