Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.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
Apache 在多站点Magento设置上配置博客_Apache_.htaccess_Rewrite_Server - Fatal编程技术网

Apache 在多站点Magento设置上配置博客

Apache 在多站点Magento设置上配置博客,apache,.htaccess,rewrite,server,Apache,.htaccess,Rewrite,Server,我有两个网站,分别是abc.com和pqr.com,运行于相同的Magento安装。现在我想通过wordpress为每个域创建博客,我在根Magento目录中为这些域创建了一个文件夹“blogs”,并在名为blogs/abc和blogs/pqr的文件夹中安装了wordpress的两个实例 如何在根目录中配置my.htaccess或index.php,以便分别将对www.abc.com/blog和www.pqr.com/blog的请求路由到blogs/abc和blogs/pqr文件夹 请注意,我希

我有两个网站,分别是abc.com和pqr.com,运行于相同的Magento安装。现在我想通过wordpress为每个域创建博客,我在根Magento目录中为这些域创建了一个文件夹“blogs”,并在名为blogs/abc和blogs/pqr的文件夹中安装了wordpress的两个实例

如何在根目录中配置my.htaccess或index.php,以便分别将对www.abc.com/blog和www.pqr.com/blog的请求路由到blogs/abc和blogs/pqr文件夹

请注意,我希望我的博客URL的形式是abc.com/blog,而不是blog.abc.com

############################################
## you can put here your magento root folder
## path relative to web root

    RewriteBase /

############################################
## uncomment next line to enable light API calls processing

#    RewriteRule ^api/([a-z][0-9a-z_]+)/?$ api.php?type=$1 [QSA,L]

############################################
## rewrite API2 calls to api.php (by now it is REST only)

    RewriteRule ^api/rest api.php?type=rest [QSA,L]

############################################
## workaround for HTTP authorization
## in CGI environment

    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

############################################
## TRACE and TRACK HTTP methods disabled to prevent XSS attacks

    RewriteCond %{REQUEST_METHOD} ^TRAC[EK]
    RewriteRule .* - [L,R=405]

############################################
## redirect for mobile user agents

    #RewriteCond %{REQUEST_URI} !^/mobiledirectoryhere/.*$
    #RewriteCond %{HTTP_USER_AGENT} "android|blackberry|ipad|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC]
    #RewriteRule ^(.*)$ /mobiledirectoryhere/ [L,R=302]

############################################
## always send 404 on missing files in these folders

    RewriteCond %{REQUEST_URI} !^/(media|skin|js)/

############################################
## never rewrite for existing files, directories and links

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-l


#Redirect Blogs

#RewriteCond %{HTTP_HOST} ^(?:www\.)?(abc|pqr)\.com$ [NC]
#RewriteRule ^blog(?:/(.*))?$ /blogs/%1/$1 [NC,L]


############################################
## rewrite everything else to index.php

    RewriteRule .* index.php [L]




</IfModule>
############################################
##您可以将magento根文件夹放在这里
##相对于web根目录的路径
重写基/
############################################
##取消注释下一行以启用轻API调用处理
#重写规则^api/([a-z][0-9a-z]+)/?$api.php?type=$1[QSA,L]
############################################
##重写对api.php的API2调用(现在只剩下REST)
重写规则^api/restapi.php?type=rest[QSA,L]
############################################
##HTTP授权的变通方法
##在CGI环境中
重写规则。*-[E=HTTP\U授权:%{HTTP:AUTHORIZATION}]
############################################
##禁用跟踪和跟踪HTTP方法以防止XSS攻击
RewriteCond%{REQUEST_METHOD}^TRAC[EK]
重写规则。*-[L,R=405]
############################################
##移动用户代理重定向
#重写cond%{REQUEST_URI}^/mobiledirectoryhere/*$
#重写Cond%{HTTP|u USER|u AGENT}“android |黑莓| ipad | iphone | ipod | iemobile | opera mobile | palmos | webos | googlebot mobile”[NC]
#重写规则^(.*)$/mobiledirectoryhere/[L,R=302]
############################################
##在这些文件夹中丢失文件时始终发送404
重写cond%{REQUEST_URI}^/(媒体|皮肤| js)/
############################################
##决不重写现有文件、目录和链接
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写cond%{REQUEST_FILENAME}-L
#重定向博客
#RewriteCond%{HTTP\u HOST}^(?:www\)?(abc|pqr)\.com$[NC]
#重写规则^blog(?:/(.*)?$/blogs/%1/$1[NC,L]
############################################
##将所有其他内容重写为index.php
重写规则。*index.php[L]

如果您有权访问vhost配置(通常为/etc/apaches/sites enabled/abc),只需输入

Alias /blog /var/www/blogs/abc
输入abc.com的vhost和pqr.com的vhost的模拟


您还需要启用mod_别名。在.htaccess文件中无法执行此操作,另请参见将以下内容添加到根.htaccess:

RewriteEngine on

RewriteCond %{HTTP_HOST} ^(?:www\.)?(abc|pqr)\.com$ [NC]
RewriteRule ^blog(?:/(.*))?$ /blogs/%1/$1 [NC,L]

请重新排列.htaccess的结尾部分

#Redirect Blogs

RewriteCond %{HTTP_HOST} ^(?:www\.)?(abc|pqr)\.com$ [NC]
RewriteRule ^blog(?:/(.*))?$ /blogs/%1/$1 [NC,L]

############################################
## rewrite everything else to index.php
## but never rewrite for existing files, directories and links

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l

RewriteRule .* index.php [L]

请注意,
RewriteCond
和紧跟其后的
RewriteRule
一起构成重定向规则。你把博客相关的规则放在博客相关的规则之间,把博客相关的规则放在他们之间,把他们之间,把他们之间的博客相关的规则放在他们之间,把他们之间的博客相关的规则放在他们之间,把他们的功能性打破之间。。

当我写我的时候,当我写这篇代码的时候,我写这篇代码的时候,当我写这段代码的时候,当我写的时候,当我当我写这段代码的时候,当我写这段代码的时候,当我当我写的时候,当我写的时候,当我的时候,当我写这段代码的时候,当我写这段代码的时候,当当我写的时候,当我的时候,当我的时候,当我写的时候,当我的时候,当我的时候,当我当我写的时候,当我的时候,当我在我在我写的时候,当我的时候,当我的时候,当我的时候,当我在我在我我################将所有其他内容重写为index.php RewriteRule.*index.php[L]-请求到example=abc的位置。请,在问题中张贴您当前的htaccess,以便我能更好地理解您的规则。从my.htaccess中添加了重定向部分。我已在/var/www/vhosts/abc/conf/中创建了vhost.conf,并在上述行中创建了eNet。我需要重新启动服务器吗?