开发者

Codeigniter + Opencart on one host -- URI routing problems

OK I searched the boards and could not found any specific answer. the website and the shop aren't the same. Codeigniter has been used for handling everything so now I want to add a shop using Opencart and the URI routing is the problem.

(The truth is Im not a CI fan but since the guy before me used it I have no other choice but to continue and now I have to add a shop along CI!)

Should I s开发者_StackOverflow中文版eparate the website from the shop and put each one into a separate folder on the host and use .htaccess rewrite rules to handle URI related to each MVC or can I do something simple?


You should be able to create a folder at the same level of your CI "system" folder and in there you can copy all the shop files. You then just access the shop via domain.com/shop/

I don't think you need to change any routing or .htaccess rules if you already have the default .htaccess file in place that removes index.php from the CI urls. I'm doing this on several sites and it works fine.

EDIT: here is my full .htaccess file for a site where this works fine

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /    

    redirect 301 /disclaimer/disclaimer.html /disclaimer.html

    #Removes access to the system folder by users.
    #Additionally this will allow you to create a System.php controller,
    #previously this would not have been possible.
    #'system' can be replaced if you have renamed your system folder.
    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    #Checks to see if the user is attempting to access a valid file,
    #such as an image or css document, if this isn't true it sends the
    #request to index.php
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d

    #special rule to allow the 301 redirect from above
    RewriteCond %{REQUEST_URI} !disclaimer/disclaimer.html$ 

    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>



<IfModule !mod_rewrite.c>
    # If we don't have mod_rewrite installed, all 404's
    # can be sent to index.php, and everything works as normal.
    # Submitted by: ElliotHaughin

    ErrorDocument 404 /index.php
</IfModule>

#####################################################
# CONFIGURE media caching
#
Header unset ETag
FileETag None
<FilesMatch "(?i)^.*\.(ico|flv|jpg|jpeg|png|gif|js|css)$">
Header unset Last-Modified
Header set Expires "Fri, 21 Dec 2012 00:00:00 GMT"
Header set Cache-Control "public, no-transform"
</FilesMatch>
#
#####################################################

<IfModule mod_deflate.c>
<FilesMatch "\.(js|css)$">
SetOutputFilter DEFLATE
</FilesMatch>
</IfModule>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜