一个主机上的Codeigniter + Opencart - URI路由问题

时间:2010-07-15 07:46:54

标签: codeigniter codeigniter-url

好的,我搜查了电路板,找不到任何具体的答案。 网站和商店不一样。 Codeigniter已被用于处理所有内容,所以现在我想使用Opencart添加商店,并且URI路由是问题所在。

(事实上,我不是CI粉丝,但由于我之前的人使用它,我别无选择,只能继续,现在我必须在CI上添加一个商店!)

我应该将网站与商店分开并将每个网站放在主机上的单独文件夹中,并使用.htaccess重写规则来处理与每个MVC相关的URI,还是可以做一些简单的事情?

1 个答案:

答案 0 :(得分:0)

您应该能够在CI“system”文件夹的同一级别创建一个文件夹,然后您可以复制所有商店文件。然后,您只需通过domain.com/shop/

访问该商店

如果您已经使用默认的.htaccess文件从CI网址中删除index.php,我认为您不需要更改任何路由或.htaccess规则。我在几个网站上这样做,它工作正常。

编辑:这是我的完整.htaccess文件,用于一个工作正常的网站

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