How does this implementation of the CNC affect the speed of the site?

I wanted to do this. From this:

http://localhost/site/f2.php?fa=5

get

http://localhost/site/red   (т.е. red имеет fa=5 )

The usual way through regular expressions does not work for me and I did it perversely:

RewriteEngine On
RewriteRule red f2.php?fa=5
RewriteRule blue f2.php?fa=6
RewriteRule white f2.php?fa=2 (и т.д. у меня может получиться сотни таких строк)
..........

I understand that this is a madhouse and no one does it like that … but if it works and if it doesn’t affect the speed of the site, then why not .. I wanted to know if I have about 500 such lines in htaccess, it will affect on site speed or something else?

I just really need a person to be able to type a short address in the address bar and find what they need … and I also understand that if they click in the usual way, then it’s still in the address. line will be written http://localhost/site/f2.php?fa=5… well, let it be, but it can enter shorter and get there… what do you think about it? thanks!введите код здесь


Answer 1, authority 100%

I do this and my main input is index.php

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ index.php?route=$1 [L,QSA]

url can be split through explode, in your case http://localhost/site/red, I guess that you need to pull some data from the database according to the condition where the table column is red, then by typing the code you can get this, the url will remain beautiful, and you don’t need 100500 entries in .htaccess, here’s what it looks like

<?php
if(isset($_GET['route']))
    {
        $exp = explode($_GET['route'], '/')
        if($exp[0] == 'site')
        {
            $sql = mysql_query("select * from `table` where `name` = '". $exp[1] ."'") or die(mysql_error());
            while($row = mysql_fetch_assoc($sql))
            {
                echo $row['id'].$row['value'];
            }
        }
    }
?>
?>

Leave a reply

Please enter your comment!
Please enter your name here