1

我有多个 CI 应用程序,在 CI 项目的主目录中有两个索引文件,它们指向应用程序目录(indexl.php && oglasnik.php)。我在这里之前已经写过一个关于这个问题的问题。

我想要做的是将去往 oglasnik 的每个请求路由到 oglasnik.php。

这是我的 .htacces 文件:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /PublishWall/
    DirectoryIndex indexl.php
    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ indexl.php?/$1 [L]

    RewriteCond $1 !^(indexl\.php|oglasnik\.php|images|robots\.txt)
    RewriteCond %{REQUEST_URI} ^application.*
    RewriteRule ^(.*)$ indexl.php?/$1 [L]

    RewriteRule ^oglasnik$ oglasnik.php [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> 
php_value date.timezone "Europe/Ljubljana"
AddDefaultCharset utf-8

RewriteRule ^oglasnik$ oglasnik.php [L] 这应该将 oglasnik 重写为 oglasnik.php 并且确实如此,但是当它这样做时,它直接指向 404_override 而不是默认控制器,默认控制器设置为 OK,当我输入 locahost 时它可以工作/PublishWall/oglasnik.php。

请求的重写日志:

127.0.0.1 - - [31/Jan/2013:07:14:48 +0100] [localhost/sid#841d38][rid#16bb100/initial] (3) [perdir C:/wamp/www/PublishWall/] strip per-dir prefix: C:/wamp/www/PublishWall/oglasnik -> oglasnik
127.0.0.1 - - [31/Jan/2013:07:14:48 +0100] [localhost/sid#841d38][rid#16bb100/initial] (3) [perdir C:/wamp/www/PublishWall/] applying pattern '^(.*)$' to uri 'oglasnik'
127.0.0.1 - - [31/Jan/2013:07:14:48 +0100] [localhost/sid#841d38][rid#16bb100/initial] (4) [perdir C:/wamp/www/PublishWall/] RewriteCond: input='/PublishWall/oglasnik' pattern='^system.*' => not-matched
127.0.0.1 - - [31/Jan/2013:07:14:48 +0100] [localhost/sid#841d38][rid#16bb100/initial] (3) [perdir C:/wamp/www/PublishWall/] strip per-dir prefix: C:/wamp/www/PublishWall/oglasnik -> oglasnik
127.0.0.1 - - [31/Jan/2013:07:14:48 +0100] [localhost/sid#841d38][rid#16bb100/initial] (3) [perdir C:/wamp/www/PublishWall/] applying pattern '^(.*)$' to uri 'oglasnik'
127.0.0.1 - - [31/Jan/2013:07:14:48 +0100] [localhost/sid#841d38][rid#16bb100/initial] (4) [perdir C:/wamp/www/PublishWall/] RewriteCond: input='oglasnik' pattern='!^(indexl\.php|oglasnik\.php|images|robots\.txt)' => matched
127.0.0.1 - - [31/Jan/2013:07:14:48 +0100] [localhost/sid#841d38][rid#16bb100/initial] (4) [perdir C:/wamp/www/PublishWall/] RewriteCond: input='/PublishWall/oglasnik' pattern='^application.*' => not-matched
127.0.0.1 - - [31/Jan/2013:07:14:48 +0100] [localhost/sid#841d38][rid#16bb100/initial] (3) [perdir C:/wamp/www/PublishWall/] strip per-dir prefix: C:/wamp/www/PublishWall/oglasnik -> oglasnik
127.0.0.1 - - [31/Jan/2013:07:14:48 +0100] [localhost/sid#841d38][rid#16bb100/initial] (3) [perdir C:/wamp/www/PublishWall/] applying pattern '^oglasnik$' to uri 'oglasnik'
127.0.0.1 - - [31/Jan/2013:07:14:48 +0100] [localhost/sid#841d38][rid#16bb100/initial] (2) [perdir C:/wamp/www/PublishWall/] rewrite 'oglasnik' -> 'oglasnik.php'
127.0.0.1 - - [31/Jan/2013:07:14:48 +0100] [localhost/sid#841d38][rid#16bb100/initial] (3) [perdir C:/wamp/www/PublishWall/] add per-dir prefix: oglasnik.php -> C:/wamp/www/PublishWall/oglasnik.php
127.0.0.1 - - [31/Jan/2013:07:14:48 +0100] [localhost/sid#841d38][rid#16bb100/initial] (2) [perdir C:/wamp/www/PublishWall/] trying to replace prefix C:/wamp/www/PublishWall/ with /PublishWall/
127.0.0.1 - - [31/Jan/2013:07:14:48 +0100] [localhost/sid#841d38][rid#16bb100/initial] (4) add subst prefix: oglasnik.php -> /PublishWall/oglasnik.php
127.0.0.1 - - [31/Jan/2013:07:14:48 +0100] [localhost/sid#841d38][rid#16bb100/initial] (1) [perdir C:/wamp/www/PublishWall/] internal redirect with /PublishWall/oglasnik.php [INTERNAL REDIRECT]
127.0.0.1 - - [31/Jan/2013:07:14:48 +0100] [localhost/sid#841d38][rid#173b580/initial/redir#1] (3) [perdir C:/wamp/www/PublishWall/] strip per-dir prefix: C:/wamp/www/PublishWall/oglasnik.php -> oglasnik.php
127.0.0.1 - - [31/Jan/2013:07:14:48 +0100] [localhost/sid#841d38][rid#173b580/initial/redir#1] (3) [perdir C:/wamp/www/PublishWall/] applying pattern '^(.*)$' to uri 'oglasnik.php'
127.0.0.1 - - [31/Jan/2013:07:14:48 +0100] [localhost/sid#841d38][rid#173b580/initial/redir#1] (4) [perdir C:/wamp/www/PublishWall/] RewriteCond: input='/PublishWall/oglasnik.php' pattern='^system.*' => not-matched
127.0.0.1 - - [31/Jan/2013:07:14:48 +0100] [localhost/sid#841d38][rid#173b580/initial/redir#1] (3) [perdir C:/wamp/www/PublishWall/] strip per-dir prefix: C:/wamp/www/PublishWall/oglasnik.php -> oglasnik.php
127.0.0.1 - - [31/Jan/2013:07:14:48 +0100] [localhost/sid#841d38][rid#173b580/initial/redir#1] (3) [perdir C:/wamp/www/PublishWall/] applying pattern '^(.*)$' to uri 'oglasnik.php'
127.0.0.1 - - [31/Jan/2013:07:14:48 +0100] [localhost/sid#841d38][rid#173b580/initial/redir#1] (4) [perdir C:/wamp/www/PublishWall/] RewriteCond: input='oglasnik.php' pattern='!^(indexl\.php|oglasnik\.php|images|robots\.txt)' => not-matched
127.0.0.1 - - [31/Jan/2013:07:14:48 +0100] [localhost/sid#841d38][rid#173b580/initial/redir#1] (3) [perdir C:/wamp/www/PublishWall/] strip per-dir prefix: C:/wamp/www/PublishWall/oglasnik.php -> oglasnik.php
127.0.0.1 - - [31/Jan/2013:07:14:48 +0100] [localhost/sid#841d38][rid#173b580/initial/redir#1] (3) [perdir C:/wamp/www/PublishWall/] applying pattern '^oglasnik$' to uri 'oglasnik.php'
127.0.0.1 - - [31/Jan/2013:07:14:48 +0100] [localhost/sid#841d38][rid#173b580/initial/redir#1] (1) [perdir C:/wamp/www/PublishWall/] pass through C:/wamp/www/PublishWall/oglasnik.php

这应该可行,我想?但事实并非如此。这在日志末尾是什么意思,当我访问 index.php 时也会发生这种情况,它工作正常。

4

0 回答 0