i am building a web site using PHP and TWIG, i have organized my code into: class folder: for php classes lib folder: for non-classes php files templates folder: for twig templates and index.php file
when i want to include a link for register page for example the link will be: domain-name/lib/register.php the question is: is there any good way of hiding the file organization from the link for example to make the link something like: domain-name/register without changing my file organization and preserving the ability to send get parameters in the url?
thanks
Here's an example htaccess file I would use. Folder structures entered after "register/" are treated as variables that forward to register.php. The QSA flag will allow you to have additional GET variables treated as vars if need be. (e.g. /register/something/?some_var=1).
This is for specific cases when you know how many variables you want to rewrite for what pages. In other words, the below will only work with two variables/spots (e.g. /registers/var1/var2/).
Hope that helps!
If you are using apache, you can use the
mod_rewrite
module with a.htaccess
file http://httpd.apache.org/docs/2.0/mod/mod_rewrite.htmlFor other webservers similar modules and methods exist.