Clean URLs
A page is named in the query string - /shop/?products/42 - or by the path behind the application: /shop/products/42. The path is mapped onto the files, and a file or directory whose name is a bracketed variable name stands for any one segment. The segment becomes that variable before the page's PHP runs:
| url | file | variables |
|---|---|---|
/shop/products/42
|
products/[id].pad
|
$id is 42
|
/shop/products/new
|
products/new.pad
|
a name of its own wins over a bracket |
/shop/blog/2026/hello-pad
|
blog/[year]/[slug].pad
|
$year and $slug
|
/shop/docs/a/b
|
docs/[path+].pad
|
$path is the rest, a/b
|
The same names resolve wherever a page is named - here through {page}, with shop/products/[id].pad and shop/blog/[year]/[slug].pad beside the fragment:
|
PHP |
HTML fragments/clean_urls_1.pad |
Result |
|---|---|---|
|
Product number 42 2026: hello pad |
-
?products/42resolves the same way, so the application runs on a server that routes no paths, and/shop/index.php/products/42works everywhere. A bracketed file is never reached by its own name. - Every
?pagelink keeps working: on a clean URL, a query string that starts with a bare page name - the relativehref="?about"- names that page. -
$padCleanUrls = TRUEin_config/config.phpmakes$padGowrite/shop/products/42. Apache needs one line,FallbackResource /shop/index.php;php -Sneeds nothing.