简体   繁体   中英

how to remove /index.php?/ while redirect 301 codeigniter pyrocms

while doing some tasks i have this issue that i couldint fix

the Domain was multilingual on subdomain like this link

http://ru.example.com

so i need to remake it to be directory :

http://example.com/ru

until now every thing is Okay and work find

while i tried to redirect old links to new links with this htaccess code

RewriteEngine on
RewriteCond %{HTTP_HOST} ^ru.example.com$
RewriteRule ^(.*)$ http://example.com/ru/$1 [L,NC,QSA]

so the result was example.com/ru/index.php?/about-us

and its wrong call i wanna help on this to become

  example.com/ru/about-us

im using Pyrocms that build on codigniter

finally it solved

in main Index.php file of Pyrocms Codeigniter based CMS

My Boss Added This code and problem Solved

if (strpos($_SERVER['SERVER_NAME'], 'ar.') !== false) {

$pageURL = 'http';
if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") {
    $pageURL .= "s";
}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
    $pageURL .= str_replace('ar.', '', $_SERVER["SERVER_NAME"]) . ":" . '/ar/' . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"];
} else {
    $pageURL .= str_replace('ar.', '', $_SERVER["SERVER_NAME"]) . '/ar/' . $_SERVER["REQUEST_URI"];
}

header("HTTP/1.1 301 Moved Permanently");
header("Location: " . $pageURL);
die();
}

Thanks ...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM