D
D
Denis Bukreev2016-07-12 18:55:27
PHP
Denis Bukreev, 2016-07-12 18:55:27

How to embed a static page into a website?

So it goes.
It is required to embed a landing page instead of a page generated by the server.
Those. there is an address domain/products/okna, which displays a page with windows
Instead of this entire page, you need to put in a landing page
. I tried to do a redirect in htaccess (just to the main page from this page):

RewriteCond %{QUERY_STRING} ^products/okna/
RewriteRule ^(.*)$ http://www.domain.ru/ [L,R=301]

It does not exit, the server still shows its page with windows.
How to be?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
dev400, 2016-07-12
@dev400

Maybe just a redirect to php?
This is put in index.php closer to the beginning of the file, before routing is initialized

<?php
function redirect($url) {

    if (headers_sent() === false)
    {
        header('Location: ' . $url, true, 302);
    }

    exit();
}

$pattern = '~^/products/okna/$~';
$url_path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);

if ( preg_match($pattern, $url_path) ) {

    redirect('http://google.com');

}

V
Viktor Taran, 2016-07-15
@shambler81

put an exception for this page into the CNC generator of the site
Then the CNC will bypass it

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question