Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/templates/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Templates 没有index.php,除主页外的Magento URL无法工作_Templates_Magento_Url Rewriting - Fatal编程技术网

Templates 没有index.php,除主页外的Magento URL无法工作

Templates 没有index.php,除主页外的Magento URL无法工作,templates,magento,url-rewriting,Templates,Magento,Url Rewriting,我的magento安装在Ubuntu Linux上的/var/www/magento下。 这个问题看起来像档案中的一些问题 但实际上有些不同。当我在上安装Magento时 Ubuntu Linux I启用了Apache mod_重写URL重写 当我转到http://localhost/magento时 我的服务器将URL重写为http://localhost/magento/ 并显示页面。然后单击其中一个链接 在导航栏中,假设它是导航栏项“foo”。 然后magento带我去: http://l

我的magento安装在Ubuntu Linux上的/var/www/magento下。 这个问题看起来像档案中的一些问题 但实际上有些不同。当我在上安装Magento时 Ubuntu Linux I启用了Apache mod_重写URL重写

当我转到http://localhost/magento时 我的服务器将URL重写为http://localhost/magento/ 并显示页面。然后单击其中一个链接 在导航栏中,假设它是导航栏项“foo”。 然后magento带我去:

http://localhost/magento/foo.html

其中显示一个“未找到”apache页面

我必须将URL更改为------>

http://localhost/magento/index.php/foo.html

以显示页面

我的mod_重写工作似乎有点不对劲

谢谢

约翰·高切

配置:系统->配置->(常规->)网站:

使用Web服务器重写:是

基本URL:http://localhost/magento

如果我将“用户Web服务器重写:”设置为“否”,则链接 从我的主页上可以很好地工作,但请参见页面 http://localhost/magento/index.php/foo.html 显示正确的页面,但 该网站的工作,我不喜欢的网址。我 希望它是http://localhost/magento/foo.html 没有index.php位,因为这也可能 更友好的搜索引擎优化

谢谢

约翰·高切


更新:我已尝试取消我的人工127.0.1.1 IP地址的注释 哪个ubuntu放进了/etc/hosts并把我真正的IP放在那里 不走运。我仍然有完全相同的问题。还有里面的URL 我的浏览器被重写为http://localhost/etc。。。当我 在其中键入192.168.3.31、avalanche或avalanche.com。 我还在想办法解决这个问题 如上所述,这并没有做到这一点

127.0.0.1       localhost
#127.0.1.1      avalanche

192.168.4.35    avalanche avalanche.com
当我重新启动Apache时,我得到:

# service apache2 restart
 * Restarting web server apache2                                                apache2: Could not reliably determine the server's fully qualified domain name, using 192.168.4.35 for ServerName
 ... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 192.168.4.35 for ServerName
不确定如何修复原始问题。我正在本地服务器上测试


我甚至尝试过这个解决方案,然后重新启动了apache2,但没有成功

因此:

RewriteEngine On
RewriteBase /mymagento/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
不起作用,即使使用RewriteBase/,也不起作用


好的,我终于解决了这个问题。 文件/etc/apache2/sites已启用/000默认值 为所有目录设置了以下指令 在此文件中定义:

 AllowOverride None
例如,对于/var/www,它是默认的文档根目录 在Ubuntu 12.04 LTS Linux系统上设置此文件包含

    <Directory /var/www/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride None
            Order allow,deny
            allow from all
    </Directory>
这意味着您将能够覆盖服务器配置指令 可在/etc/apache2/apache2.conf(或/etc/apache2/httpd.conf)中找到 包括在内)

AllowOverride默认设置为None的原因之一可能是 这会降低服务器速度,另一个是出于安全原因。这 指令应设置在标记内,并且 后者可以超越前者。另一个原因不是这样的 默认设置为必须递归解析.htaccess 每次打开目录路径中的文件时 加载可能会降低系统速度,从而使 .htaccess填充在/etc/apache2/httpd.conf中 建议使用“可能”,因为它可能会导致 提高速度

那么地方

    <Directory /var/www/>
            Options Indexes FollowSymLinks MultiViews
            #AllowOverride None
            AllowOverride All
            Order allow,deny
            allow from all
    </Directory>

选项索引跟随符号链接多视图
#不允许超限
允许超越所有
命令允许,拒绝
通融
内部/etc/apache2/sites enabled/000默认值

并运行:服务apache2重新启动

是解决方案。

您的Magento根目录中有吗?此外,您可能会遇到有关
localhost
的问题。建议使用127.0.0.1或在主机文件中映射开发域。

您尝试过:

RewriteBase /magento/
而不是重写base/mymagento/,因为您的url是http://localhost/magento/

您的apache虚拟主机是否允许覆盖配置,例如

<VirtualHost *:80>
...
<Directory /var/www/magento/>
    AllowOverride All
</Directory>
</VirtualHost>

...
允许超越所有

在Magento配置中(通过系统>配置在Magento管理面板中访问),有一些相关设置可确定最终搜索引擎友好URL的外观

Web > Search Engine Optimization > Use Web Server Rewrites
应始终打开的设置。否则“/index.php/”将添加到URL中,这是不必要的,看起来很难看要启用此选项,还需要在宿主环境中启用Apache mod_rewrite

Catalog > Search Engine Optimizations > Product URL Suffix
这里的默认值是“.html”,它将附加到每个产品URL。一些SEO专家声称这是提高评级所必需的,而其他SEO专家则表示并非如此。为了我们与Joomla的MageBridge集成!此设置必须为空

Catalog > Search Engine Optimizations > Category URL Suffix
同上,但现在是类别

Catalog > Search Engine Optimizations > Use categories path for product URLs
启用此选项后,产品URL还将包括类别URL键。虽然可以说这会导致内容重复,但产品页面也可能从中受益,因为它们成为更大结构的一部分

Catalog > Search Engine Optimizations > Use Canonical Link Meta Tag For Products
如果您真的担心重复内容(这并不像有些人会告诉您的那样糟糕),那么您可以启用canonical标记,一旦检测到重复内容,该标记将告诉搜索引擎哪个页面处于领先位置

Catalog > Search Engine Optimizations > Use Canonical Link Meta Tag For Categories
同上,但适用于类别

Catalog > Search Engine Optimizations > Use categories path for product URLs

进一步阅读这篇文章

我在将我的实时站点转移到本地主机时遇到了同样的问题。最后我解决了

我有windows操作系统。所以我使用WAMP堆栈作为本地主机。我花了很多时间通过更改.htaccess文件、修改数据库中的core_config_数据表来检索本地主机中的所有URL及其内容,但一切都出错了

最后,我得到了在Apache服务器中启用rewrite_模块的线索。 1.要启用它,请单击任务栏中的Wamp图标(Wamp->Apache->Apache模块->并选择重写模块)。 2.重新启动Wamp服务器。 3.清除缓存(我认为是可选的)-删除var/cache文件夹中的所有文件

确保根文件夹中有.htaccess文件(localhost/magento/.htaccess)。如果你没有,你就不会得到结果

那是
<VirtualHost ...>
...
<Directory /var/www>
    Options Indexes FollowSymLinks MultiViews   
    AllowOverride All
    Order allow,deny
    allow from all 
</Directory>

</VirtualHost>
sudo a2enmod rewrite
sudo /etc/init.d/apache2 force-reload 
//(not service apache2 restart)
Go to admin url of your site. 
Suppose,http://example.com/index.php/admin/

Go to 'System' menu from navigation and click on 'Configuration'.
Under the 'General' tab in the left, click on 'Web'.
Open the 'Search Engines Optimization' section by clicking on it.
Then set 'Use Web Server Rewrites' value to 'No'