![](/img/trans.png)
[英]remove index.php and 301 redirect with codeigniter and htaccess
[英]how to remove /index.php?/ while redirect 301 codeigniter pyrocms
在执行某些任务时,我遇到无法解决的问题
域在子域上是多语言的,例如此链接
所以我需要将其重新制作为目录:
直到现在一切都好,找到工作
虽然我尝试使用此htaccess代码将旧链接重定向到新链接
RewriteEngine on
RewriteCond %{HTTP_HOST} ^ru.example.com$
RewriteRule ^(.*)$ http://example.com/ru/$1 [L,NC,QSA]
所以结果是example.com/ru/index.php?/about-us
和它的错误称呼,我想对此有所帮助
example.com/ru/about-us
我正在使用基于codigniter的Pyrocms
终于解决了
在基于Pyrocms Codeigniter的CMS的主要Index.php文件中
我的老板已添加此代码并解决了问题
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();
}
谢谢 ...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.