Created
March 12, 2020 08:13
-
-
Save aktaumag/cd3b7f71fc588166725dd9850ff5b15c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Основные перенаправления и прочие настройки в файле .htaccess |
Перенаправление на страницу без index.php
БИТРИКС
<?php
// START WebSEO.kz Michael Nossov:
$wscanonical = 'https://' . $_SERVER['HTTP_HOST'] . str_replace('index.php', '', $APPLICATION->GetCurPage(true));
if(isset($_REQUEST['PAGEN_1']) && !empty($_REQUEST['PAGEN_1']) && intval($_REQUEST['PAGEN_1']) > 1){
$wscanonical .= '?PAGEN_1='.intval($_REQUEST['PAGEN_1']);
}
// Перенаправление на страницу без index.php
$ws_uri_parts = explode('?', $_SERVER['REQUEST_URI'], 2);
if(substr($ws_uri_parts[0], -10) == '/index.php'){
header("HTTP/1.1 301 Moved Permanently");
header("Location: ".$wscanonical);
exit();
}
// END WebSEO.kz
?>
ДРУГОЕ
// Перенаправление на страницу без index.php
$ws_uri_parts = explode('?', $_SERVER['REQUEST_URI'], 2);
$ws_uri_protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://";
$ws_uri_canonical = $ws_uri_protocol . $_SERVER['HTTP_HOST'] . $ws_uri_parts[0];
if(substr($ws_uri_parts[0], -10) == '/index.php'){
header("HTTP/1.1 301 Moved Permanently");
header("Location: ".$ws_uri_canonical );
exit();
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.