We can find two types of web pages:
1) web pages that are made with static HTML pages – every single page has it’s own self-standing HTML page which is seen by the browser.
2) CMS systems or dinamic pages – the HTML code is generated from data found on the entire page or on one single section of the page and it appears when loading the page.
For HTML static pages, the beautiful URL name is automatically generated, but things are not as simple when we are talking about dinamic pages. In this article we want to talk about transforming the URL of dinamic pages and CMS systems in beautiful URL names.
A dinamic page displays many contents and it is possible to have 2-3 parameters which is far from a beautiful URL. You might think that if only a few contents are generated by the processing page, then simply clone the page and,after, in each copy add parameters. This, however, is an uncomfortable procedure, if the parameters are only 10 possible variants. In its place would be ideal, if one could define a URL with parameters of the processing parameters of the content to appear without the URL may change.
Fortunately, in the case of Apache servers,if the administrator has allowed for your personal page enabling the “.htaccess”, you can redefine the default settings of the server for our own page. The “.htaccess” file is a text file (ASCII), where there are commands and settings and you need to load them into that directory, subdirectories you want to remove. So if you load it into the main directory of the website, then the new settings will be valid for the entire page. With the help of htaccess are achievable by the above-mentioned desires, i.e. we can define as the inclusion of a nice URL to the output which processing pages to appear in the browser. The solution, though,it works, results in the case of large pages cannot use convenient, because for each page redirect should be defined separately. If our site has 3,000 pages (each for a product) then you should produce 3,000 such rules.
Real power forwards the htaccess redirects based on regular expressions. This means that if the visitor enters from the keyboard a URL that URL passes through a system of rules, which decides which file will process the order. Often it happens that the same file will process all orders. This variable receives the file parameters generated by regular expressions, and from here it will know what it need to see.
Regular expressions and the use of the file .htaccess are more complicated than a simple edit HTML, that’s why before use is recommended to use a system of testing and studying of use. This is easily achieved with a simple Google search after the terms “htaccess.txt” and “regular expressions”.