The adventure php framework enables you, to operate web pages or applications in url rewrite mode or in normal mode. URL rewriting means, that URL params are separated by "/" instead of "&" and "=". This request layout pretends, that the requested ressource is located in a folder path. Another side effect is, that search engines tend to scan slash URLs more likely. Please note, that this technique does not supersede normal search engine optimization.
If you use the URL rewrite mode, please be aware, that the bootstrap file (e.g. index.php) must be located in the DOCUMENT_ROOT of your webserver or any VHOST. Otherwise, the assignment of params and values can not be guaranteed.
Using the URL rewrite mode a .htaccess file must be created. The following code box shows you an example, that can be used with the bigger part of your applications:
# start mod_rewrite
RewriteEngine on
# exclude some directories
RewriteCond %{REQUEST_URI} !^(\/frontend) [NC]
# define the rule itself. Every request that is not matching the exception list is
# redirected to the index.php file
RewriteRule !(index\.php|\.css|\.jpe?g|\.png|\.gif|\.ico)$ /index.php?apf-rewrited-query=%{REQUEST_URI}&%{QUERY_STRING} [NC,L]Please note, that the definition
/index.php?apf-rewrited-query=%{REQUEST_URI}&%{QUERY_STRING}must remain unaffected. It defines the param, that is used by the PageControllerInputFilter and FrontControllerInputFilter to analyze the URL parameters and write them to the $_REQUEST-Array. The exception list
!(index\.php|\.css|\.jpe?g|\.png|\.gif|\.ico)$can be manipulated as desired.
Registry::register('apf::core','URLRewriting',true);In order to apply url rewriting without changing an application, the framework brings a output filter, that rewrites links automatically. In order to explicitly exclude links, the link attribute linkrewrite can be set to false. As of release 1.10, mailto: links are excluded by default.
Besides, the link generation mechnism introduced in release 1.14 can be used to directly format links using the desired layout.