如何将子文件夹中的Magento安装路径定向到主域名 [英] How To Direct Magento installation path in subfolder to main domain name

查看:112
本文介绍了如何将子文件夹中的Magento安装路径定向到主域名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将Magento 1.7.0.2安装到mydomain.com/mag

I have installed Magento 1.7.0.2 to mydomain.com/mag

(mydomain-是我的托管帐户中的主要注册域) (mag-是任何子文件夹)

(mydomain - is the primary registered domain at my hosting account) (mag - is any subfolder)

当我的网站处于测试模式时,如果出现任何问题,我只需要删除"mag"文件夹,并且它也不会覆盖public_html下的任何文件.

As my website in testing mode, if anything goes wrong, i simply have to delete the "mag" folder and also it does not overwrite any files under public_html.

但是,如果我直接安装到直接以root身份安装的public_html上,那么它可能会覆盖少量文件或文件夹,并且如果我想随时还原,那么我将无法手动执行.

But if i install on directly to root directly public_html, then it may overwrite few files or folders and if i want to revert any time, then i cannot do that manually.

在安装magento之前,我什至不知道public_html下的确切文件夹和文件默认结构.

As i don’t even know the exact folder and file default structure under public_html prior to magento installation.

(我一次做错了,那件事发生了)

(I did that once by mistake, that happened)

现在,前端站点的URL将是mydomain.com/mag

Now at frontend the site URL will be mydomain.com/mag

但是我想,如果客户键入 http://www.mydomain.com ,他们将能够而不是键入 http://www.mydomain.com/mag

But i want, if customers type the http://www.mydomain.com, they will be able to see the LIVE website instead of typing http://www.mydomain.com/mag

我该怎么做

此外,这对于SEO部分是否可以.

Also, will this be OK for SEO part.

我们需要在Magento后端中执行此操作吗? 或者 我们是否需要通过设置子域类型来与托管公司联系 或者 通过告诉简单脚本安装,将安装文件夹从mydomain.com/mag更改为www.mydomain.com

Do we need to do this in Magento backend. or Do we need to do with hosting company by setting sub-domain type or By telling Simple scripts the installation to change the installation folder from mydomain.com/mag to www.mydomain.com

请建议我该怎么做.

致谢

推荐答案

System > Config > Web中,您将为基本URL"找到以下设置.要对此进行更新,您将必须执行以下3个步骤:

In System > Config > Web you will find the following settings for your 'base url'. To update this you will have to perform the following 3 steps:

步骤1:将默认存储设置为正确的基本网址

请注意,基本网址已定义了子文件夹.

Notice that the base url has the subfolder defined.

第2步:将您的STORE VIEW基本URL设置为根URL

使用左侧的下拉菜单,将当前配置范围"更改为商店视图[NOT DEFAULT]

Using your dropdown on the left, change the "Current configuration scope" to your store view [NOT DEFAULT]

要更改基本url值,请取消选中使用网站",然后输入新的基本url:

To change the base url value, uncheck 'use website' and enter your new base url:

此外,在同一屏幕中再次检查会话文件管理cookie路径是否设置为站点的根文件夹,以及域是否正确:

Also, double-check in the same screen that your Session file management cookie path is set to the root folder of your site and that the domain is correct:

第3步[也用于多个商店的管理]

最后,这很重要,您需要复制index.php文件,.htaccess文件,并将您的media,skin和js文件夹符号链接到根目录,因为它们仅可用于子文件夹Magento基本安装现在-我们需要让您的主域知道在哪里寻找Magento!

Finally, and this is important, you need to copy the index.php file, .htaccess file, and symlink your media,skin and js folders to your root directory, because they're only available to your subfolder Magento base install right now - we need to let your main domain know where to look for Magento!

Magento安装目录(在您的情况下为mag)中的安全外壳中,作为sudoer:

From secure shell in your Magento installation directory (in your case, mag) as sudoer:

sudo cp index.php ../
sudo cp .htaccess ../
sudo ln -s js ../
sudo ln -s skin ../
sudo ln -s media ../

您的管理员仍将在yoursite.com/mag/admin处可用.

Your admin will still be available at yoursite.com/mag/admin.

在此主webroot(您刚刚复制的文件)中编辑index.php文件,并在第45行附近对其进行更新:

Edit your index.php file in this main webroot (the file you just copied) and update it around line 45:

$mageFilename = 'app/Mage.php';

将其更改为:

$mageFilename = 'cart/app/Mage.php';

其中"mag"是子文件夹.在您的情况下,您将使用名为"mag"的文件夹.最后,您需要清除缓存,这些更改才能生效.

Where 'mag' is the subfolder. In your case you'd use the folder named 'mag'. Finally, you need to clear the cache for these changes to take effect.

第4步:多商店[可选]

如果您拥有多个商店,则可以通过这种方式为所有商店提供服务,但是您需要编辑index.php文件以为其提供正确的商店代码.可以在此处找到有关此信息的更多信息:

If you have more than one store, they can all be served this way, but you need to edit the index.php file to give it the correct store code. More info about that can be found here:

http://www.magentocommerce. com/knowledge-base/entry/overview-how-multiple-websites-stores-work

这篇关于如何将子文件夹中的Magento安装路径定向到主域名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆