Fishpig字preSS的Magento - http://site.com/blog解析为www.site.com而不是www.site.com/blog而不是、Magento、http、Fi

2023-09-02 10:08:03 作者:你再发光我就拔你插头

我有一个工作Fishpig字preSS Magento的生产服务器上的实例。

I have a working Fishpig Wordpress Magento instance on a production server.

所有的绿色刻度显示它已成功地配置和访问时,

All the green ticks show it has succesfully configured and when visiting

http://www.site.com/blog 

它的工作原理。然而,当我尝试和访问

it works. However when I try and and visit

http://site.com/blog 

发送我回Magento的主页,www.site.com。

it sends me back to the magento home page at www.site.com .

我已经试过了URL中字preSS设置既 http://site.com/blog和 http://www.site.com/blog 但在这两种情况下,它总是向我发送到主页在site.com。

I have tried setting the url in wordpress to both http://site.com/blog and http://www.site.com/blog but in both situations it always sends me to the home page at site.com.

这是因为试图访问的位置时,最有经验的互联网用户将无法输入WWW关心的问题。

This is a concern because most experienced web users will not type www when trying to access a location.

我的htaccess是由字preSS产生的,看起来像

My htaccess is as generated by Wordpress and looks like

的DirectoryIndex index.html的的index.php

DirectoryIndex index.html index.php

<IfModule mod_rewrite.c>

#wp generated
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

请不字preSS站点文件位于site.com/wp,这是fishpig扩展直接安排其在不存在/博客的路径。

Please not the wordpress site files are located at site.com/wp and it is the fishpig extension which arranges the direct from the non existent /blog path.

推荐答案

首先,要启动,要解决这个问题的一种方法是简单地让你的Magento网站默认为不具备WWW。在URL中。

First of all, to start of, one way to resolve the issue is to simply make your Magento website DEFAULT to not have the www. in the url.

在Magento的,请进入系统>配置>网站

In Magento, go to System > Configuration > Web.

在安全和不安全标签,找到基本URL。

In the "Secure" and "Unsecure" tabs, find "Base URL."

的值应该是这个样子:

http://www.site.com/

替换所有引用到该域,它表明:

Replace ALL references to the domain so it shows:

http://site.com/

不幸的是,可能有很多它整个网站露面。你需要做同样的事情在其他地方的服务器上。

Unfortunately, there may be a lot of appearances of it throughout the site. You'll need to do the same thing elsewhere on the server.

如果你真的想你的网站/博客说了万维网。虽然,你将有.htaccess文件在Magento正确转发。我不是太热衷于如何Magento的.htaccess文件的工作原理,但我知道如何转发一个网址,并保持它的所有其他页面,以及(但是,Magento的设置可能会干扰)。

If you really want your site/blog to say www., though, you'll have to properly forward the .htaccess file in Magento. I'm not too keen on how Magento's .htaccess file works, but I do know how to forward a url and keep all of its additional pages as well (however, Magento's setup may interfere).

在code应该是这个样子:

The code should look something like this:

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^site.com$ [NC,OR]
RewriteRule ^(.*)$ http://www.site.com$1 [R=301,L]

此外,我不知道该怎么好这将与Magento的成立,但我已经成功地使用了上述code重定向的URL正确的URL我想要的。这code以上实际使用的一个词preSS的网站,虽然。

Again, I don't know how well this will work with Magento's set up, but I've successfully used the above code to redirect url's to the correct url I want. That code above was actually used on a wordpress site, though.

检查重写规则,Magento的.htaccess文件,并尝试把这个上面。要小心,虽然;这是很容易,如果你陷入困境的.htaccess文件会导致500内部服务器错误,因此始终保持一个备份。

Check for Rewrite rules in Magento's .htaccess file and try putting this above it. Be careful, though; it is VERY easy to cause 500 internal server errors if you mess up the .htaccess file, so always keep a backup.

尝试了这一点,我希望它能帮助。

Try this out and I hope it helps.