Page 1 of 1

The variable $1 represents 'products' in our example

Posted: Sun Dec 22, 2024 9:24 am
by zihadhasan019
And $2 represents 'zhu-zhu-pets' from our example. The rest of the text is not dynamic and used directly. The rule is decoding the clean URL, and passing it to your web server in the way it understands, reversing the arrow direction in the image at the beginning! Special Rules The last section [QSA, L] are special rules. The QSA stands for Query String Append, which translated means that if a query string is added after the URL, pass it along to the target URL.


russia email list ort=price would be transformed for the server into The L represents Last Rule. If there are more than one rules in your .htaccess file, and this rule is true, stop and don't go through any further rules. Some Variations - Food for Thought Of course, this example isn't very controlled, so you may wish to force only a few options for 'products' since this will be turned into a specific .




php file. Thus, the first set of parenthesis ([A-Za-z0-9]+) could be replaced with the following: (products|pages|staff) RewriteRule ^(products|pages|staff)/([A-Za-z0-9-]+)/?$ $1.php?item=$2 [QSA,L] This new format says that the only valid entries are 'products' OR 'pages' OR 'staff'. If anything else is entered by the visitor, the rule will not be true and they will see your 404 page (you have a customized one, right?)! For a cheat sheet about doing even more with mod_rewrite, I recommend grabbing the Added Bytes mod_rewrite cheat sheet and keeping a copy nearby.