Hello! I do SEO optimization for one samopisny website. The site has products that are in the / products / folder, and a specific product, for example, / products / product_a /, also has some sort of sections (such as dividing products into styles) / products? Style = 1, and products with style = 1. I do not really want to climb into the wilds of Sam-Sapon CMS. I heard that it is possible to configure the CNC from htaccess so that similar pages (previously known) / products? Style = 1, / products? Style = 2, / products? Style = 3 in the URL look like / products / classik /, / products / modern /, / products / wood / etc. At the same time, nothing changes in the engine itself. Is it possible to configure such rules for previously known addresses or is it a myth?

Thank you in advance!

Created a local project, with one index.php

<?php switch ($_REQUEST["style"]) { case "0": echo "Class\n"; break; case "1": echo "Modern\n"; break; default: echo "not params \n"; } 

?>

and .htaccess file

RewriteEngine On

RewriteRule ^ / classik / $ /? Style = 0 [L, QSA]

RewriteRule ^ / modern / $ /? Style = 1 [L, QSA]

mod_rewrite module seems to be loading http://joxi.ru/Z8Y8VIwyTJBfCbo-OFE but for some reason it does not work all the same. How can another rule be prescribed?

    2 answers 2

    It is not very clear what it means: "they looked like this." If it is assumed that when you go to the address, say, / products / classik / the page / products? Style = 1 is loaded, you can use the following code:

     RewriteEngine On RewriteRule ^products/classik$ products?style=1 [L] RewriteRule ^products/modern$ products?style=2 [L] 

    Or even better to use the "router": redirect all such requests to a single file, and from it already connect the products file.

    • Yes, this is exactly what is meant; you need to load the products? Style = 1 page when requesting / products / classik /. Found such a thing in the code: public function indexAction () {$ style = $ this -> _ getParam ('style'); $ where = ""; if ($ style! == null) {$ f = new Zend_Filter_Int (); $ style = $ f-> filter ($ style); $ where = ($ style! == null)? "style = $ style": ""; Zend_Registry :: set ('cid', 'kitchen_type _'. $ Style); } $ model = new Kitchen_Model_Item (); $ res = $ model-> getData ($ where); $ this-> view-> res = $ res; $ this-> view-> style = $ style; } reads the style and shows the goods. - maler1988 pm
    • I wrote in the .htaccess rule for the kitchen section RewriteRule ^ kitchen / klassik $ kitchen? Style = 1 [L] - unfortunately, does not work. = ( - maler1988 pm
    • Does Rewrite itself actually work? Other parameters? - Justicet
    • Already not sure, I will try. - maler1988
    • Look, please, addition to the question, I decided to test on the local hosting, and something also wants to CNC is built. - maler1988

    This is not a myth.

    update:

     <IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^products/classik/$ /products?style=1 [L,QSA] RewriteRule ^products/modern/$ /products?style=2 [L,QSA] RewriteRule ^products/wood/$ /products?style=3 [L,QSA] </IfModule> 
    • Or maybe someone had an example lying around)) I, frankly, cannot find descriptions of such code, everywhere there are some general rules and that's it. - maler1988
    • 2
      @VenZell, Try to write more detailed answers. Explain what your statement is based on. - zb '