如何在localhost的子文件夹中安装magento

时间:2014-04-24 06:20:21

标签: magento

我正在从我们的服务器安装magento到我的localhost。我想我成功完成了这个过程。但是,css和js文件试图从localhost的根目录而不是安装它的子文件夹进行引用。

我已成功执行以下两个sql命令而没有任何效果

 Delete from core_config_data where path = 'web/cookie/cookie_domain';

 update core_config_data set value="http://127.0.0.1/xxxx/web/" where path='web/secure/base_url' or path='web/unsecure/base_url';

我还删除了var。

中的所有内容

请查看随附的两张图片以显示问题

source showing the links pointing to root of the localhost my folder structure clearly showing the files are in subfolder/subfolder/web

secure and unsecure config as seen from admin section 更改管理员密码后,我可以登录管理员部分。但是css和js文件(又名皮肤文件)仍然试图从

引用
http://127.0.0.1/skin... 

然而它应该是

http://127.0.0.1/xxx/web/skin/...

2 个答案:

答案 0 :(得分:1)

您需要更新基本网址,这通常是通过管理员从此处完成的:

  • 系统
  • 配置
  • 一般
  • 网络
  • 不安全/安全
  • 基本网址

由于您的管理员也无法访问,您需要从SQL更新它:

  • 打开SQL管理软件
  • 选择Magento DB
  • 选择表格core_config_data
  • 更新路径等于web/unsecure/base_urlweb/secure/base_url
  • 的行

或运行以下SQL查询:

update core_config_data
    set value = 'http://domainname/'
    where path = 'web/unsecure/base_url';

update core_config_data
    set value = 'http://domainname/'
    where path = 'web/secure/base_url';

答案 1 :(得分:0)

感谢队友

我能够通过以下方式解决

RewriteEngine on
RewriteCond %{HTTP_HOST} ^127.0.0.1$ [NC]
RewriteCond %{REQUEST_URI} !^/xxx/web/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /xxx/web/$1
RewriteCond %{HTTP_HOST} ^127.0.0.1$ [NC]
RewriteRule ^(/)?$ /xxx/web/index.php [L]