默认控制器自动添加到codeigniter中的url链接

时间:2014-04-16 09:06:00

标签: javascript .htaccess codeigniter

首先是我的Codeigniter

Options -Indexes
Options +FollowSymLinks
Options -MultiViews
DirectoryIndex index.php

<IfModule mod_rewrite.c>

    RewriteEngine On
    RewriteBase /

    ### Canonicalize codeigniter URLs

    # If your default controller is something other than
    # "welcome" you should probably change this
    RewriteRule ^(welcome(/index)?|index(\.php)?)/?$ / [L,R=301]
    RewriteRule ^(.*)/index/?$ $1 [L,R=301]

    # Removes trailing slashes (prevents SEO duplicate content issues)
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.+)/$ $1 [L,R=301]

    # 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
    RewriteRule ^(.*)$ index.php/$1 [L]

    </IfModule>
    <IfModule !mod_rewrite.c>
    # Without mod_rewrite, route 404's to the front controller
    ErrorDocument 404 /index.php

</IfModule>

现在一切都在默认路线上运行良好,这是受欢迎的。

在拒绝任何其他页面后,某些JavaScripts将无法加载。 这是apache访问日志

实际资产位于assets/core/

127.0.0.1 - - [16/Apr/2014:13:45:10 +0500] "GET         /welcome/assets/core/js/client.search.js?ver=1.0.2 HTTP/1.1" 404 1175
127.0.0.1 - - [16/Apr/2014:13:45:10 +0500] "GET /welcome/assets/core/js/client.twitter.js?ver=1.0.2 HTTP/1.1" 404 1175
127.0.0.1 - - [16/Apr/2014:13:45:10 +0500] "GET /welcome/assets/core/js/lib/md5.js?  ver=1.0.2 HTTP/1.1" 404 1175
127.0.0.1 - - [16/Apr/2014:13:45:10 +0500] "GET /welcome/assets/core/js/client.flickr.js?ver=1.0.2 HTTP/1.1" 404 1175

如果我将默认路由更改为任何其他页面,那么该页面将完美运行,但所有其他页面将具有相同的问题..

/welcome/会自动添加到链接中,我们将不胜感激。

0 个答案:

没有答案