PHP script to make page as a folder structure
I have a website with different pages but the query string looks ugly, how can I make it look like a folder structure instead of a query string, in开发者_JAVA百科stead of actually having folders in my www?
You can try out this free online tool : http://www.webconfs.com/url-rewriting-tool.php just type in your dynamic ( ugly ) url and copy the generated Directory-type htaccess code and paste it in the .htaccess file ( if it doesn't exist, create one ) in your root directory. Ensure that mod_rewrite is active in your php.ini configuration file. To know more about it, you can google the term.
After reading your question a few times, I think you're referring to routing.
If you're using apache, you can look at
http://httpd.apache.org/docs/current/mod/mod_rewrite.html
You can look at this tutorial for php:
http://www.phpaddiction.com/tags/axial/url-routing-with-php-part-one/
You have to enable mod-rewrite and define rewrite rules in .htaccess page.
here is some useful document.
http://www.sitepoint.com/guide-url-rewriting/
If you want to use routing in your application, I'd suggest having a look at Symfony's Routing component, which you can use standalone.
精彩评论