. Updated Daily. Editions SDA India   SDA Indonesia
JAX Asia 2008 - Conference for Enterprise Java, SOA, Spring, Web Services, Ajax, Agile and more
BUSINESS ENTERPRISE SOLUTIONS ARCHITECTURE INFORMATION SECURITY WIRELESS & MOBILITY DATA & STORAGE DEVELOPMENT HARDWARE













News

Monday, 2 April 2007

Article: Learn About URL Routing with PHP

 

 

Doug Hill in the first part of the series on URL routing with PHP explores a simple procedural URL routing method that contains many of the disadvantages. He says to note that the requirements will be PHP and Apache with mod_rewrite enabled.

He discusses the article under the following heads:

Redirecting with mod_rewrite

He says this article doesn’t discuss mod_rewrite and the .htaccess in detail, the .htaccess file is sufficient for the needs of the simple front controller. He says that the .htaccess file should be placed in the same directory as the front controller script. All requests will be sent to index.php while requests for a file or directory that does exist will bypass the mod_rewrite rules and be served directly by the web server.

The Entry Point

He chose a simple format for the incoming URL, a command followed by its parameters separated by forward slashes ‘/’. He gives examples to make his point clearer.

Dispatching the Command

He says that having a command with its parameters stored in an array it is trivial to handle them via a switch statement. He gives a short example to explain the pointer.

 

Read the Post

 
 
print save email comment

print

save

email

comment

 
 

Search SDA Asia

Free eNewsletter

SDA Asia Magazine Free Download
 
 
 
Copyright @ 2008 SDA Asia Magazine - All Right Reserved Privacy Policy | Terms of Use