Magento安装在WAMP上并且工作正常。
站点网址= localhost / shop< - || - > ADMIN URL = localhost / shop / index.php / admin
我把这个magento移到了Godaddy服务器上。它不在根文件夹中。该网站位于名为“shop”
的子文件夹中站点网址= mydomain.com/shop< - || - > ADMIN URL = mydomain.com/shop/index.php/admin
前端网址运行正常 - mydomain.com/shop/customer/account/login /
管理员网址未包含“index.php”。当我删除“index.php”并手动调用url然后它正在工作。
我希望我的管理员网址为http://mydomain.com/shop/admin/system_config/edit/ ....
使用Web服务器重写=是
RewriteBase / shop /
我该如何解决这个问题?
答案 0 :(得分:1)
可在此处找到替代解决方案: How to remove index.php from admin URL
答案 1 :(得分:0)
要从Magento管理URL删除index.php,请在Magento文件夹的/shop/index.php文件顶部添加以下代码:
<?php
function curPageURL() {
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;
}
$curUrl = curPageURL();
$pos = strpos($curUrl, "index.php");
// Note our use of ===. Simply == would not work as expected
// because the position of 'a' was the 0th (first) character.
if ($pos === false) {
//echo "The string '$findme' was not found in the string '$mystring'";
} else {
//echo "The string '$findme' was found in the string '$mystring'";
//echo " and exists at position $pos";
$newUrl = str_replace("index.php/", "", $curUrl);
header("Location: $newUrl");
exit;
}
?>
享受:)