[nycphp-talk] Do you use Pretty URLs
Guilherme Blanco
guilhermeblanco at gmail.com
Wed Dec 12 12:29:43 EST 2007
The simples way to achieve nifty URLs is using a ForceType directive.
For example... you create a file named 'app' and fill this file with
php code. It'll not be executed.
Then you do the trick and ForceType this file to be interpreted by PHP:
<Files app>
ForceType application/x-httpd-php
</Files>
Now it'll execute the source you defined there.
To handle URLs like: http://www.domain.com/app/controller/action/arg1/arg2
You need to explode the URL you have:
// URL Exploding
$address = explode( $_SERVER['SCRIPT_NAME'], $_SERVER['PHP_SELF'] );
$address_exp = array();
// Parsing URL pieces
if ( isset( $address[1] ) ) {
$address_exp = explode( '/', $address[1] );
// Removing blank index
array_shift( $address_exp );
}
Now you have $address_exp with the pieces you want.
In my framework, I used this way:
Controller1/SubController1_1/.../Action/arg_name,arg_value/arg_array,arg_value1,arg_value2,...
This can be easily achieved using some PHP.
Now just open your imagination and you can create Search Engine
Friendly URLs. Just remember that SE Spiders does not like ?, & and
other weird characters on URL.
If you have any other question, do not hesitate to send messages in this thread.
Regards,
On Dec 12, 2007 3:03 PM, Patrick May <patrick at hexane.org> wrote:
> On 12/12/07, inforequest <1j0lkq002 at sneakemail.com> wrote:
> > At this point I'm all in favor of a neutral bolt-on rewrite router.
>
> I'm using an agnostic router class:
>
> http://hexane.org/releases/2007.12.12/class.pm_router.txt
>
> I tried to stick to the basics. Let me know if this is useful. Also
> let me know if you have any patches or suggestions.
>
> Cheers,
>
> Patrick
>
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> NYPHPCon 2006 Presentations Online
> http://www.nyphpcon.com
>
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php
>
--
Guilherme Blanco - Web Developer
CBC - Certified Bindows Consultant
Cell Phone: +55 (16) 9166-6902
MSN: guilhermeblanco at hotmail.com
URL: http://blog.bisna.com
São Carlos - SP/Brazil
More information about the talk
mailing list