我有类似的这种两级笨的应用例子 。 我创建了两个index.php
文件,如例子说(第二个被命名为oglasnik.php)。 我想打电话给应用,而无需调用所需的应用程序的文件名。
我把这个作为我举一个例子。 所以我的.htaccess文件现在的问题是:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /PublishWall/
DirectoryIndex indexl.php
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ indexl.php?/$1 [L]
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ indexl.php?/$1 [L]
RewriteCond $1 !^(indexl\.php|oglasnik\.php|images|robots\.txt)
RewriteRule ^oglasnik$ oglasnik.php [L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>
php_value date.timezone "Europe/Ljubljana"
AddDefaultCharset utf-8
当我的路线oglasnik我得到404页面没有找到,不应该这样的规则:
RewriteRule ^oglasnik$ oglasnik.php [L]
重写它oglasnik.php。 当我去oglasnik.php它工作正常。
另外我珍玩找出如何路由actualy工作。 是否重写URL访问.htacces文件再次,这是我在看到这个答案 。
重写日志:
127.0.0.1 - - [30/Jan/2013:23:35:36 +0100] [localhost/sid#991d38][rid#15b10d8/initial] (3) [perdir C:/wamp/www/PublishWall/] strip per-dir prefix: C:/wamp/www/PublishWall/oglasnik -> oglasnik
127.0.0.1 - - [30/Jan/2013:23:35:36 +0100] [localhost/sid#991d38][rid#15b10d8/initial] (3) [perdir C:/wamp/www/PublishWall/] applying pattern '^(.*)$' to uri 'oglasnik'
127.0.0.1 - - [30/Jan/2013:23:35:36 +0100] [localhost/sid#991d38][rid#15b10d8/initial] (4) [perdir C:/wamp/www/PublishWall/] RewriteCond: input='/PublishWall/oglasnik' pattern='^system.*' => not-matched
127.0.0.1 - - [30/Jan/2013:23:35:36 +0100] [localhost/sid#991d38][rid#15b10d8/initial] (3) [perdir C:/wamp/www/PublishWall/] strip per-dir prefix: C:/wamp/www/PublishWall/oglasnik -> oglasnik
127.0.0.1 - - [30/Jan/2013:23:35:36 +0100] [localhost/sid#991d38][rid#15b10d8/initial] (3) [perdir C:/wamp/www/PublishWall/] applying pattern '^(.*)$' to uri 'oglasnik'
127.0.0.1 - - [30/Jan/2013:23:35:36 +0100] [localhost/sid#991d38][rid#15b10d8/initial] (4) [perdir C:/wamp/www/PublishWall/] RewriteCond: input='oglasnik' pattern='!^(indexl\.php|oglasnik\.php|images|robots\.txt)' => matched
127.0.0.1 - - [30/Jan/2013:23:35:36 +0100] [localhost/sid#991d38][rid#15b10d8/initial] (4) [perdir C:/wamp/www/PublishWall/] RewriteCond: input='/PublishWall/oglasnik' pattern='^application.*' => not-matched
127.0.0.1 - - [30/Jan/2013:23:35:36 +0100] [localhost/sid#991d38][rid#15b10d8/initial] (3) [perdir C:/wamp/www/PublishWall/] strip per-dir prefix: C:/wamp/www/PublishWall/oglasnik -> oglasnik
127.0.0.1 - - [30/Jan/2013:23:35:36 +0100] [localhost/sid#991d38][rid#15b10d8/initial] (3) [perdir C:/wamp/www/PublishWall/] applying pattern '^(oglasnik)$' to uri 'oglasnik'
127.0.0.1 - - [30/Jan/2013:23:35:36 +0100] [localhost/sid#991d38][rid#15b10d8/initial] (2) [perdir C:/wamp/www/PublishWall/] rewrite 'oglasnik' -> 'oglasnik.php'
127.0.0.1 - - [30/Jan/2013:23:35:36 +0100] [localhost/sid#991d38][rid#15b10d8/initial] (3) [perdir C:/wamp/www/PublishWall/] add per-dir prefix: oglasnik.php -> C:/wamp/www/PublishWall/oglasnik.php
127.0.0.1 - - [30/Jan/2013:23:35:36 +0100] [localhost/sid#991d38][rid#15b10d8/initial] (2) [perdir C:/wamp/www/PublishWall/] trying to replace prefix C:/wamp/www/PublishWall/ with /PublishWall/
127.0.0.1 - - [30/Jan/2013:23:35:36 +0100] [localhost/sid#991d38][rid#15b10d8/initial] (4) add subst prefix: oglasnik.php -> /PublishWall/oglasnik.php
127.0.0.1 - - [30/Jan/2013:23:35:36 +0100] [localhost/sid#991d38][rid#15b10d8/initial] (1) [perdir C:/wamp/www/PublishWall/] internal redirect with /PublishWall/oglasnik.php [INTERNAL REDIRECT]
127.0.0.1 - - [30/Jan/2013:23:35:36 +0100] [localhost/sid#991d38][rid#151b500/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 - - [30/Jan/2013:23:35:36 +0100] [localhost/sid#991d38][rid#151b500/initial/redir#1] (3) [perdir C:/wamp/www/PublishWall/] applying pattern '^(.*)$' to uri 'oglasnik.php'
127.0.0.1 - - [30/Jan/2013:23:35:36 +0100] [localhost/sid#991d38][rid#151b500/initial/redir#1] (4) [perdir C:/wamp/www/PublishWall/] RewriteCond: input='/PublishWall/oglasnik.php' pattern='^system.*' => not-matched
127.0.0.1 - - [30/Jan/2013:23:35:36 +0100] [localhost/sid#991d38][rid#151b500/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 - - [30/Jan/2013:23:35:36 +0100] [localhost/sid#991d38][rid#151b500/initial/redir#1] (3) [perdir C:/wamp/www/PublishWall/] applying pattern '^(.*)$' to uri 'oglasnik.php'
127.0.0.1 - - [30/Jan/2013:23:35:36 +0100] [localhost/sid#991d38][rid#151b500/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 - - [30/Jan/2013:23:35:36 +0100] [localhost/sid#991d38][rid#151b500/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 - - [30/Jan/2013:23:35:36 +0100] [localhost/sid#991d38][rid#151b500/initial/redir#1] (3) [perdir C:/wamp/www/PublishWall/] applying pattern '^(oglasnik)$' to uri 'oglasnik.php'
127.0.0.1 - - [30/Jan/2013:23:35:36 +0100] [localhost/sid#991d38][rid#151b500/initial/redir#1] (1) [perdir C:/wamp/www/PublishWall/] pass through C:/wamp/www/PublishWall/oglasnik.php