我安装了锂电池,所有的.htaccess工作正常。
我需要在app / webroot / shop
中安装OpenCart作为购物车我复制了所有文件,并将锂安装的根文件夹中的.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>
当我浏览http://domain.com/shop时,我需要http://domain.com/app/webroot/shop/
页面出错:
Exception
lithium\action\DispatchException (code 404)
Action `webroot` not found.
请帮我解决这个问题。
答案 0 :(得分:1)
您可以尝试这样做:
<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>
答案 1 :(得分:0)
问题在于,您最后的“全部捕获”规则还将商店的所有请求重定向到您不想要的锂电池。
试试这个
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]