Question

I have a lithium installation and all the .htaccess works fine.

I need to install OpenCart as a shopping cart in app/webroot/shop

I copied all the files and also changed the .htaccess file in the root folder of lithium installation as

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

Still when I browse http://domain.com/shop it takes me to http://domain.com/app/webroot/shop/

With an error on page:

Exception
lithium\action\DispatchException (code 404)
Action `webroot` not found.

Please help me in solving this problem.

Was it helpful?

Solution

You may try this instead:

<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>

OTHER TIPS

The problem is that your last "catch all" rule is also redirecting all requests for the shop to lithium, which you don't want.

Try this

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]
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top