Ответы пользователя по тегу Apache HTTP Server
  • ЧПУ url как у вк?

    @MaksPaverov
    .htaccess:
    RewriteEngine On
        RewriteBase /
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule . /index.php [L]


    index.php:
    <?php
        $url = explode('/',strtolower(substr($_SERVER['REQUEST_URI'], 1)));
    
        switch($url[0]) {
            case '': { 
                include 'pages/main.php';
                break;
            }
            case 'how_to_buy':{
                include 'pages/how_to_buy.php';
                break;
            }
            case 'payment_methods':{
                include 'pages/payment_methods.php';
                break;
            }
            case 'guarantees':{
                include 'pages/guarantees.php';
                break;
            }
            case 'payment':{
                include 'pages/payment.php';
                break;
            }
            case 'myorders':{
                include 'pages/myorders.php';
                break;
            }
        }
    ?>
    Ответ написан
    1 комментарий