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
.htaccess 锂离子电池/apache中商店的重写规则_.htaccess_Lithium - Fatal编程技术网

.htaccess 锂离子电池/apache中商店的重写规则

.htaccess 锂离子电池/apache中商店的重写规则,.htaccess,lithium,.htaccess,Lithium,我安装了锂电池,所有的.htaccess都可以正常工作 我需要在app/webroot/shop中将OpenCart安装为购物车 我复制了所有文件,并将Lili安装根文件夹中的.htaccess文件更改为 <IfModule mod_rewrite.c> RewriteEngine on RewriteBase / RewriteRule shop/(.*) /app/webroot/shop/$1 [L] RewriteRule ^$ app/webroot/

我安装了锂电池,所有的.htaccess都可以正常工作

我需要在app/webroot/shop中将OpenCart安装为购物车

我复制了所有文件,并将Lili安装根文件夹中的.htaccess文件更改为

<IfModule mod_rewrite.c>
 RewriteEngine on
 RewriteBase /
 RewriteRule    shop/(.*) /app/webroot/shop/$1 [L]
 RewriteRule    ^$ app/webroot/    [L]
 RewriteRule    (.*) app/webroot/$1 [L]
</IfModule>

请帮我解决这个问题。

您可以尝试以下方法:

<IfModule mod_rewrite.c>
Options +FollowSymlinks -MultiViews
RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_URI} !/app/webroot/shop/? [NC]
RewriteRule  ^shop/(.*) /app/webroot/shop/$1    [L,NC]

RewriteCond %{REQUEST_URI} !/app/webroot/? [NC]
RewriteRule  ^$   /app/webroot/  [L,NC]

RewriteCond %{REQUEST_URI} !/app/webroot/? [NC]
RewriteRule  ^(.*) /app/webroot/$1     [L,NC]
</IfModule>

选项+以下符号链接-多视图
重新启动发动机
重写基/
重写cond%{REQUEST_URI}/app/webroot/shop/?[北卡罗来纳州]
重写规则^shop/(.*)/app/webroot/shop/$1[L,NC]
重写cond%{REQUEST_URI}/app/webroot/?[北卡罗来纳州]
重写规则^$/app/webroot/[L,NC]
重写cond%{REQUEST_URI}/app/webroot/?[北卡罗来纳州]
重写规则^(.*)/app/webroot/$1[L,NC]

您可以尝试以下方法:

<IfModule mod_rewrite.c>
Options +FollowSymlinks -MultiViews
RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_URI} !/app/webroot/shop/? [NC]
RewriteRule  ^shop/(.*) /app/webroot/shop/$1    [L,NC]

RewriteCond %{REQUEST_URI} !/app/webroot/? [NC]
RewriteRule  ^$   /app/webroot/  [L,NC]

RewriteCond %{REQUEST_URI} !/app/webroot/? [NC]
RewriteRule  ^(.*) /app/webroot/$1     [L,NC]
</IfModule>

选项+以下符号链接-多视图
重新启动发动机
重写基/
重写cond%{REQUEST_URI}/app/webroot/shop/?[北卡罗来纳州]
重写规则^shop/(.*)/app/webroot/shop/$1[L,NC]
重写cond%{REQUEST_URI}/app/webroot/?[北卡罗来纳州]
重写规则^$/app/webroot/[L,NC]
重写cond%{REQUEST_URI}/app/webroot/?[北卡罗来纳州]
重写规则^(.*)/app/webroot/$1[L,NC]

问题在于,您最后的“一网打尽”规则也将商店的所有请求重定向到了Limition,这是您不想要的

试试这个

Options +FollowSymlinks -MultiViews
RewriteEngine On

# Rewrite all URLs that start with /shop to /app/webroot/shop
RewriteRule  ^shop/.? /app/webroot/shop%{REQUEST_URI}    [L]

# Rewrite all URLs that don't start with /app/webroot/shop to /app/webroot
RewriteCond %{REQUEST_URI} !^/app/webroot/shop
RewriteRule .? /app/webroot%{REQUEST_URI}     [L]

问题是,您最后的“一网打尽”规则也会将商店的所有请求重定向到Limition,这是您不想要的

试试这个

Options +FollowSymlinks -MultiViews
RewriteEngine On

# Rewrite all URLs that start with /shop to /app/webroot/shop
RewriteRule  ^shop/.? /app/webroot/shop%{REQUEST_URI}    [L]

# Rewrite all URLs that don't start with /app/webroot/shop to /app/webroot
RewriteCond %{REQUEST_URI} !^/app/webroot/shop
RewriteRule .? /app/webroot%{REQUEST_URI}     [L]

浏览
http://domain.com/shop/
o只是
http://domain.com/
,是否转到
http://domain.com/app/webroot/...
没有任何错误吗?当我浏览到domain.com/somecontroller时,它会正确浏览。当我浏览到domain.com/somecontroller时,它也会非常完美。我只想在app/webroot/shop中添加一个shop文件夹,这样当我访问domain.com/shop时,它应该从shop folder加载文件。如果您可以将服务器的docroot直接指向app/webroot文件夹,而不是limition的根文件夹,这会更好。您可能不需要任何特殊的.htaccess规则。当您浏览
http://domain.com/shop/
o只是
http://domain.com/
,是否转到
http://domain.com/app/webroot/...
没有任何错误吗?当我浏览到domain.com/somecontroller时,它会正确浏览。当我浏览到domain.com/somecontroller时,它也会非常完美。我只想在app/webroot/shop中添加一个shop文件夹,这样当我访问domain.com/shop时,它应该从shop folder加载文件。如果您可以将服务器的docroot直接指向app/webroot文件夹,而不是limition的根文件夹,这会更好。您可能不需要任何特殊的.htaccess规则,然后.error已更改。。。它重定向到Exception Lili\action\DispatchException(代码404)action
webroot
找不到。很遗憾,我看到的是相同的错误消息。也许您想尝试使用[R,L,NC]标志而不是[L,NC]来查看发生了什么。请确保在任何测试之前清除浏览器的缓存。我会尝试让您知道,事实上,我的答案中的规则确实是重定向到
domain.com/app/webroot/shop
,您在问题中的规则也是如此。我的规则集防止循环,并确保最后一条规则不应用于以前重写的URL,但错误404是由替换URL生成的,而不是由传入URL生成的。所以这个问题肯定还有另外一个原因。很抱歉,我帮不上忙,我不熟悉Limition。可能OpenCart在
/shop
加载了一个脚本,导致了错误。错误已更改。。。它重定向到Exception Lili\action\DispatchException(代码404)action
webroot
找不到。很遗憾,我看到的是相同的错误消息。也许您想尝试使用[R,L,NC]标志而不是[L,NC]来查看发生了什么。请确保在任何测试之前清除浏览器的缓存。我会尝试让您知道,事实上,我的答案中的规则确实是重定向到
domain.com/app/webroot/shop
,您在问题中的规则也是如此。我的规则集防止循环,并确保最后一条规则不应用于以前重写的URL,但错误404是由替换URL生成的,而不是由传入URL生成的。所以这个问题肯定还有另外一个原因。很抱歉,我帮不上忙,我对锂离子电池不熟悉。可能是OpenCart在
/shop
加载了一个脚本导致了错误。