Any questions involving matching text strings to patterns - the pattern is called a "regular expression."
Moderator: General Moderators
pickle
Briney Mod
Posts: 6445 Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:
Post
by pickle » Mon Mar 02, 2009 12:07 pm
Hi all,
I've got an .htaccess file that is using mod_rewrite to ...rewrite. This file works fine on SuSE 10, but not on Ubuntu. I have verified mod_rewrite is enabled on the Ubuntu box.
The pattern(s):
Code: Select all
RewriteRule ^templates/$ /templates.php?o=id&d=desc
RewriteRule ^templates/(.*)/(.*)/ /templates.php?o=$1&d=$2
Expected results:
User requests:
/templates/
Page served:
/templates.php?o=id&d=desc
User requests:
/templates/name/asc/
Page served:
/templates.php?o=name&d=asc
When I request this url:
/templates/id/asc/ , this is the relevant portions of $_SERVER:
Code: Select all
[QUERY_STRING] =>
[REQUEST_URI] => /templates/id/asc/
[SCRIPT_NAME] => /templates.php
[PATH_INFO] => /id/asc/
[PATH_TRANSLATED] => /var/www/id/asc/
[PHP_SELF] => /templates.php/id/asc/
As you can see, $_SERVER['QUERY_STRING'] is empty. It is supposed to have "o=id&d=asc".
As I mentioned, this is working on 2 other servers that are running SuSE 10 - I'm just having trouble on my Ubuntu box. Any insight would be appreciated.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
josh
DevNet Master
Posts: 4872 Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida
Post
by josh » Mon Mar 02, 2009 12:36 pm
setup a rewrite log directive & increase the loglevel, see if there's anything interesting, post it here and I'll see if there's anything I notice. The rewrite engine is kind of wacky, in the way it handles conditionals and the way it loops if it matches rules. Also try an [L] flag your rewrites might just be coupled
pickle
Briney Mod
Posts: 6445 Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:
Post
by pickle » Mon Mar 02, 2009 2:46 pm
Here's the log file - I set the logging level to 9, so there might be some extra junk in there you don't need.
Code: Select all
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82eba10/subreq] (3) [perdir /var/www/] add path info postfix: /var/www/templates.php -> /var/www/templates.php/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82eba10/subreq] (3) [perdir /var/www/] strip per-dir prefix: /var/www/templates.php/id/asc/ -> templates.php/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82eba10/subreq] (3) [perdir /var/www/] applying pattern '^main/$' to uri 'templates.php/id/asc/'
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82eba10/subreq] (3) [perdir /var/www/] add path info postfix: /var/www/templates.php -> /var/www/templates.php/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82eba10/subreq] (3) [perdir /var/www/] strip per-dir prefix: /var/www/templates.php/id/asc/ -> templates.php/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82eba10/subreq] (3) [perdir /var/www/] applying pattern '^courses/$' to uri 'templates.php/id/asc/'
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82eba10/subreq] (3) [perdir /var/www/] add path info postfix: /var/www/templates.php -> /var/www/templates.php/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82eba10/subreq] (3) [perdir /var/www/] strip per-dir prefix: /var/www/templates.php/id/asc/ -> templates.php/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82eba10/subreq] (3) [perdir /var/www/] applying pattern '^courses/(.*)/(.*)/' to uri 'templates.php/id/asc/'
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82eba10/subreq] (3) [perdir /var/www/] add path info postfix: /var/www/templates.php -> /var/www/templates.php/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82eba10/subreq] (3) [perdir /var/www/] strip per-dir prefix: /var/www/templates.php/id/asc/ -> templates.php/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82eba10/subreq] (3) [perdir /var/www/] applying pattern '^questions/$' to uri 'templates.php/id/asc/'
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82eba10/subreq] (3) [perdir /var/www/] add path info postfix: /var/www/templates.php -> /var/www/templates.php/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82eba10/subreq] (3) [perdir /var/www/] strip per-dir prefix: /var/www/templates.php/id/asc/ -> templates.php/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82eba10/subreq] (3) [perdir /var/www/] applying pattern '^questions/(.*)/(.*)/' to uri 'templates.php/id/asc/'
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82eba10/subreq] (3) [perdir /var/www/] add path info postfix: /var/www/templates.php -> /var/www/templates.php/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82eba10/subreq] (3) [perdir /var/www/] strip per-dir prefix: /var/www/templates.php/id/asc/ -> templates.php/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82eba10/subreq] (3) [perdir /var/www/] applying pattern '^responses/$' to uri 'templates.php/id/asc/'
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82eba10/subreq] (3) [perdir /var/www/] add path info postfix: /var/www/templates.php -> /var/www/templates.php/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82eba10/subreq] (3) [perdir /var/www/] strip per-dir prefix: /var/www/templates.php/id/asc/ -> templates.php/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82eba10/subreq] (3) [perdir /var/www/] applying pattern '^responses/(.*)/(.*)/' to uri 'templates.php/id/asc/'
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82eba10/subreq] (3) [perdir /var/www/] add path info postfix: /var/www/templates.php -> /var/www/templates.php/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82eba10/subreq] (3) [perdir /var/www/] strip per-dir prefix: /var/www/templates.php/id/asc/ -> templates.php/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82eba10/subreq] (3) [perdir /var/www/] applying pattern '^templates/$' to uri 'templates.php/id/asc/'
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82eba10/subreq] (3) [perdir /var/www/] add path info postfix: /var/www/templates.php -> /var/www/templates.php/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82eba10/subreq] (3) [perdir /var/www/] strip per-dir prefix: /var/www/templates.php/id/asc/ -> templates.php/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82eba10/subreq] (3) [perdir /var/www/] applying pattern '^templates/(.*)/(.*)/' to uri 'templates.php/id/asc/'
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82eba10/subreq] (3) [perdir /var/www/] add path info postfix: /var/www/templates.php -> /var/www/templates.php/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82eba10/subreq] (3) [perdir /var/www/] strip per-dir prefix: /var/www/templates.php/id/asc/ -> templates.php/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82eba10/subreq] (3) [perdir /var/www/] applying pattern '^reports/$' to uri 'templates.php/id/asc/'
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82eba10/subreq] (3) [perdir /var/www/] add path info postfix: /var/www/templates.php -> /var/www/templates.php/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82eba10/subreq] (3) [perdir /var/www/] strip per-dir prefix: /var/www/templates.php/id/asc/ -> templates.php/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82eba10/subreq] (3) [perdir /var/www/] applying pattern '^gains/$' to uri 'templates.php/id/asc/'
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82eba10/subreq] (3) [perdir /var/www/] add path info postfix: /var/www/templates.php -> /var/www/templates.php/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82eba10/subreq] (3) [perdir /var/www/] strip per-dir prefix: /var/www/templates.php/id/asc/ -> templates.php/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82eba10/subreq] (3) [perdir /var/www/] applying pattern '^accounts/$' to uri 'templates.php/id/asc/'
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82eba10/subreq] (3) [perdir /var/www/] add path info postfix: /var/www/templates.php -> /var/www/templates.php/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82eba10/subreq] (3) [perdir /var/www/] strip per-dir prefix: /var/www/templates.php/id/asc/ -> templates.php/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82eba10/subreq] (3) [perdir /var/www/] applying pattern '^form/(.*)/' to uri 'templates.php/id/asc/'
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82eba10/subreq] (3) [perdir /var/www/] add path info postfix: /var/www/templates.php -> /var/www/templates.php/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82eba10/subreq] (3) [perdir /var/www/] strip per-dir prefix: /var/www/templates.php/id/asc/ -> templates.php/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82eba10/subreq] (3) [perdir /var/www/] applying pattern '^logout/.*' to uri 'templates.php/id/asc/'
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82eba10/subreq] (1) [perdir /var/www/] pass through /var/www/templates.php
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] add path info postfix: /var/www/templates.php~ -> /var/www/templates.php~/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] strip per-dir prefix: /var/www/templates.php~/id/asc/ -> templates.php~/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] applying pattern '^main/$' to uri 'templates.php~/id/asc/'
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] add path info postfix: /var/www/templates.php~ -> /var/www/templates.php~/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] strip per-dir prefix: /var/www/templates.php~/id/asc/ -> templates.php~/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] applying pattern '^courses/$' to uri 'templates.php~/id/asc/'
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] add path info postfix: /var/www/templates.php~ -> /var/www/templates.php~/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] strip per-dir prefix: /var/www/templates.php~/id/asc/ -> templates.php~/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] applying pattern '^courses/(.*)/(.*)/' to uri 'templates.php~/id/asc/'
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] add path info postfix: /var/www/templates.php~ -> /var/www/templates.php~/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] strip per-dir prefix: /var/www/templates.php~/id/asc/ -> templates.php~/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] applying pattern '^questions/$' to uri 'templates.php~/id/asc/'
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] add path info postfix: /var/www/templates.php~ -> /var/www/templates.php~/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] strip per-dir prefix: /var/www/templates.php~/id/asc/ -> templates.php~/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] applying pattern '^questions/(.*)/(.*)/' to uri 'templates.php~/id/asc/'
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] add path info postfix: /var/www/templates.php~ -> /var/www/templates.php~/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] strip per-dir prefix: /var/www/templates.php~/id/asc/ -> templates.php~/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] applying pattern '^responses/$' to uri 'templates.php~/id/asc/'
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] add path info postfix: /var/www/templates.php~ -> /var/www/templates.php~/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] strip per-dir prefix: /var/www/templates.php~/id/asc/ -> templates.php~/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] applying pattern '^responses/(.*)/(.*)/' to uri 'templates.php~/id/asc/'
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] add path info postfix: /var/www/templates.php~ -> /var/www/templates.php~/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] strip per-dir prefix: /var/www/templates.php~/id/asc/ -> templates.php~/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] applying pattern '^templates/$' to uri 'templates.php~/id/asc/'
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] add path info postfix: /var/www/templates.php~ -> /var/www/templates.php~/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] strip per-dir prefix: /var/www/templates.php~/id/asc/ -> templates.php~/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] applying pattern '^templates/(.*)/(.*)/' to uri 'templates.php~/id/asc/'
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] add path info postfix: /var/www/templates.php~ -> /var/www/templates.php~/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] strip per-dir prefix: /var/www/templates.php~/id/asc/ -> templates.php~/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] applying pattern '^reports/$' to uri 'templates.php~/id/asc/'
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] add path info postfix: /var/www/templates.php~ -> /var/www/templates.php~/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] strip per-dir prefix: /var/www/templates.php~/id/asc/ -> templates.php~/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] applying pattern '^gains/$' to uri 'templates.php~/id/asc/'
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] add path info postfix: /var/www/templates.php~ -> /var/www/templates.php~/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] strip per-dir prefix: /var/www/templates.php~/id/asc/ -> templates.php~/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] applying pattern '^accounts/$' to uri 'templates.php~/id/asc/'
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] add path info postfix: /var/www/templates.php~ -> /var/www/templates.php~/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] strip per-dir prefix: /var/www/templates.php~/id/asc/ -> templates.php~/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] applying pattern '^form/(.*)/' to uri 'templates.php~/id/asc/'
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] add path info postfix: /var/www/templates.php~ -> /var/www/templates.php~/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] strip per-dir prefix: /var/www/templates.php~/id/asc/ -> templates.php~/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] applying pattern '^logout/.*' to uri 'templates.php~/id/asc/'
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (1) [perdir /var/www/] pass through /var/www/templates.php~
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82dd3b0/initial] (3) [perdir /var/www/] add path info postfix: /var/www/templates.php -> /var/www/templates.php/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82dd3b0/initial] (3) [perdir /var/www/] strip per-dir prefix: /var/www/templates.php/id/asc/ -> templates.php/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82dd3b0/initial] (3) [perdir /var/www/] applying pattern '^main/$' to uri 'templates.php/id/asc/'
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82dd3b0/initial] (3) [perdir /var/www/] add path info postfix: /var/www/templates.php -> /var/www/templates.php/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82dd3b0/initial] (3) [perdir /var/www/] strip per-dir prefix: /var/www/templates.php/id/asc/ -> templates.php/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82dd3b0/initial] (3) [perdir /var/www/] applying pattern '^courses/$' to uri 'templates.php/id/asc/'
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82dd3b0/initial] (3) [perdir /var/www/] add path info postfix: /var/www/templates.php -> /var/www/templates.php/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82dd3b0/initial] (3) [perdir /var/www/] strip per-dir prefix: /var/www/templates.php/id/asc/ -> templates.php/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82dd3b0/initial] (3) [perdir /var/www/] applying pattern '^courses/(.*)/(.*)/' to uri 'templates.php/id/asc/'
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82dd3b0/initial] (3) [perdir /var/www/] add path info postfix: /var/www/templates.php -> /var/www/templates.php/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82dd3b0/initial] (3) [perdir /var/www/] strip per-dir prefix: /var/www/templates.php/id/asc/ -> templates.php/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82dd3b0/initial] (3) [perdir /var/www/] applying pattern '^questions/$' to uri 'templates.php/id/asc/'
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82dd3b0/initial] (3) [perdir /var/www/] add path info postfix: /var/www/templates.php -> /var/www/templates.php/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82dd3b0/initial] (3) [perdir /var/www/] strip per-dir prefix: /var/www/templates.php/id/asc/ -> templates.php/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82dd3b0/initial] (3) [perdir /var/www/] applying pattern '^questions/(.*)/(.*)/' to uri 'templates.php/id/asc/'
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82dd3b0/initial] (3) [perdir /var/www/] add path info postfix: /var/www/templates.php -> /var/www/templates.php/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82dd3b0/initial] (3) [perdir /var/www/] strip per-dir prefix: /var/www/templates.php/id/asc/ -> templates.php/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82dd3b0/initial] (3) [perdir /var/www/] applying pattern '^responses/$' to uri 'templates.php/id/asc/'
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82dd3b0/initial] (3) [perdir /var/www/] add path info postfix: /var/www/templates.php -> /var/www/templates.php/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82dd3b0/initial] (3) [perdir /var/www/] strip per-dir prefix: /var/www/templates.php/id/asc/ -> templates.php/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82dd3b0/initial] (3) [perdir /var/www/] applying pattern '^responses/(.*)/(.*)/' to uri 'templates.php/id/asc/'
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82dd3b0/initial] (3) [perdir /var/www/] add path info postfix: /var/www/templates.php -> /var/www/templates.php/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82dd3b0/initial] (3) [perdir /var/www/] strip per-dir prefix: /var/www/templates.php/id/asc/ -> templates.php/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82dd3b0/initial] (3) [perdir /var/www/] applying pattern '^templates/$' to uri 'templates.php/id/asc/'
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82dd3b0/initial] (3) [perdir /var/www/] add path info postfix: /var/www/templates.php -> /var/www/templates.php/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82dd3b0/initial] (3) [perdir /var/www/] strip per-dir prefix: /var/www/templates.php/id/asc/ -> templates.php/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82dd3b0/initial] (3) [perdir /var/www/] applying pattern '^templates/(.*)/(.*)/' to uri 'templates.php/id/asc/'
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82dd3b0/initial] (3) [perdir /var/www/] add path info postfix: /var/www/templates.php -> /var/www/templates.php/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82dd3b0/initial] (3) [perdir /var/www/] strip per-dir prefix: /var/www/templates.php/id/asc/ -> templates.php/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82dd3b0/initial] (3) [perdir /var/www/] applying pattern '^reports/$' to uri 'templates.php/id/asc/'
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82dd3b0/initial] (3) [perdir /var/www/] add path info postfix: /var/www/templates.php -> /var/www/templates.php/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82dd3b0/initial] (3) [perdir /var/www/] strip per-dir prefix: /var/www/templates.php/id/asc/ -> templates.php/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82dd3b0/initial] (3) [perdir /var/www/] applying pattern '^gains/$' to uri 'templates.php/id/asc/'
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82dd3b0/initial] (3) [perdir /var/www/] add path info postfix: /var/www/templates.php -> /var/www/templates.php/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82dd3b0/initial] (3) [perdir /var/www/] strip per-dir prefix: /var/www/templates.php/id/asc/ -> templates.php/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82dd3b0/initial] (3) [perdir /var/www/] applying pattern '^accounts/$' to uri 'templates.php/id/asc/'
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82dd3b0/initial] (3) [perdir /var/www/] add path info postfix: /var/www/templates.php -> /var/www/templates.php/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82dd3b0/initial] (3) [perdir /var/www/] strip per-dir prefix: /var/www/templates.php/id/asc/ -> templates.php/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82dd3b0/initial] (3) [perdir /var/www/] applying pattern '^form/(.*)/' to uri 'templates.php/id/asc/'
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82dd3b0/initial] (3) [perdir /var/www/] add path info postfix: /var/www/templates.php -> /var/www/templates.php/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82dd3b0/initial] (3) [perdir /var/www/] strip per-dir prefix: /var/www/templates.php/id/asc/ -> templates.php/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82dd3b0/initial] (3) [perdir /var/www/] applying pattern '^logout/.*' to uri 'templates.php/id/asc/'
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82dd3b0/initial] (1) [perdir /var/www/] pass through /var/www/templates.php
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] add path info postfix: /var/www/id -> /var/www/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] strip per-dir prefix: /var/www/id/asc/ -> id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] applying pattern '^main/$' to uri 'id/asc/'
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] add path info postfix: /var/www/id -> /var/www/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] strip per-dir prefix: /var/www/id/asc/ -> id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] applying pattern '^courses/$' to uri 'id/asc/'
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] add path info postfix: /var/www/id -> /var/www/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] strip per-dir prefix: /var/www/id/asc/ -> id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] applying pattern '^courses/(.*)/(.*)/' to uri 'id/asc/'
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] add path info postfix: /var/www/id -> /var/www/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] strip per-dir prefix: /var/www/id/asc/ -> id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] applying pattern '^questions/$' to uri 'id/asc/'
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] add path info postfix: /var/www/id -> /var/www/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] strip per-dir prefix: /var/www/id/asc/ -> id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] applying pattern '^questions/(.*)/(.*)/' to uri 'id/asc/'
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] add path info postfix: /var/www/id -> /var/www/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] strip per-dir prefix: /var/www/id/asc/ -> id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] applying pattern '^responses/$' to uri 'id/asc/'
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] add path info postfix: /var/www/id -> /var/www/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] strip per-dir prefix: /var/www/id/asc/ -> id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] applying pattern '^responses/(.*)/(.*)/' to uri 'id/asc/'
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] add path info postfix: /var/www/id -> /var/www/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] strip per-dir prefix: /var/www/id/asc/ -> id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] applying pattern '^templates/$' to uri 'id/asc/'
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] add path info postfix: /var/www/id -> /var/www/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] strip per-dir prefix: /var/www/id/asc/ -> id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] applying pattern '^templates/(.*)/(.*)/' to uri 'id/asc/'
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] add path info postfix: /var/www/id -> /var/www/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] strip per-dir prefix: /var/www/id/asc/ -> id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] applying pattern '^reports/$' to uri 'id/asc/'
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] add path info postfix: /var/www/id -> /var/www/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] strip per-dir prefix: /var/www/id/asc/ -> id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] applying pattern '^gains/$' to uri 'id/asc/'
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] add path info postfix: /var/www/id -> /var/www/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] strip per-dir prefix: /var/www/id/asc/ -> id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] applying pattern '^accounts/$' to uri 'id/asc/'
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] add path info postfix: /var/www/id -> /var/www/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] strip per-dir prefix: /var/www/id/asc/ -> id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] applying pattern '^form/(.*)/' to uri 'id/asc/'
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] add path info postfix: /var/www/id -> /var/www/id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] strip per-dir prefix: /var/www/id/asc/ -> id/asc/
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] applying pattern '^logout/.*' to uri 'id/asc/'
xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (1) [perdir /var/www/] pass through /var/www/id
Here's the full .htaccess file
Code: Select all
ErrorDocument 404 404.php
RewriteEngine on
# Main
RewriteCond %{SCRIPT_FILENAME} main
RewriteRule ^main/$ main.php?main [L]
# Courses
RewriteCond %{SCRIPT_FILENAME} courses
RewriteRule ^courses/$ courses.php?o=id&d=desc [L]
RewriteRule ^courses/(.*)/(.*)/ courses.php?o=$1&d=$2 [L]
# Questions
RewriteCond %{SCRIPT_FILENAME} questions
RewriteRule ^questions/$ questions.php?o=id&d=desc [L]
RewriteRule ^questions/(.*)/(.*)/ questions.php?o=$1&d=$2 [L]
# Responses
RewriteCond %{SCRIPT_FILENAME} responses
RewriteRule ^responses/$ responses.php?o=id&d=desc [L]
RewriteRule ^responses/(.*)/(.*)/ responses.php?o=$1&d=$2 [L]
# Templates
RewriteCond %{SCRIPT_FILENAME} templates
RewriteRule ^templates/$ templates.php?o=id&d=desc [L]
RewriteRule ^templates/(.*)/(.*)/ templates.php?o=$1&d=$2 [L]
# Reports
RewriteCond %{SCRIPT_FILENAME} reports
RewriteRule ^reports/$ /reports.php [L]
# Gains Analysis
RewriteCond %{SCRIPT_FILENAME} gains
RewriteRule ^gains/$ /gains_analysis.php [L]
# Accounts
RewriteCond %{SCRIPT_FILENAME} accounts
RewriteRule ^accounts/$ /accounts.php [L]
# Web form
RewriteCond %{SCRIPT_FILENAME} form
RewriteRule ^form/(.*)/ /web_form.php?id=$1 [L]
# Logout
RewriteCond %{SCRIPT_FILENAME} logout
RewriteRule ^logout/.* /logout.php
This is the output generated when I tried to just go to "templates/".
It seems to me that more rules are being applied than necessary. I thought [L] is supposed to stop that.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
josh
DevNet Master
Posts: 4872 Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida
Post
by josh » Tue Mar 03, 2009 1:06 am
Hmm yeah the [L] flag is supposed to stop it.
# strip per-dir prefix: /var/www/templates.php/id/asc/ -> templates.php/id/asc/
# xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82dd3b0/initial] (3) [perdir /var/www/] applying pattern '^logout/.*' to uri 'templates.php/id/asc/'
# xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82dd3b0/initial] (1) [perdir /var/www/] pass through /var/www/templates.php
# xxx.xxx.xxx.xxx - - [02/Mar/2009:13:38:39 --0700] [myserver.com][rid#b82f1a28/subreq] (3) [perdir /var/www/] add path info postfix: /var/www/id -> /var/www/id/asc/ < ??
pickle wrote: I've got an .htaccess file that is using mod_rewrite to ...rewrite. This file works fine on SuSE 10, but not on Ubuntu. I have verified mod_rewrite is enabled on the Ubuntu box.
As I mentioned, this is working on 2 other servers that are running SuSE 10 - I'm just having trouble on my Ubuntu box. Any insight would be appreciated.
Based on this and the wacky side effects, coupled with the knowledge that ubuntu probably comes with more crap pre-configured then any other distro, all I can suggest is trying to compile apache2 from scratch. I also know mod_rewrite actually tries to match each rewrite, then checks if there are conditions, so even if a condition is false other flags elsewhere on your system could be getting parsed that you may not be aware of, but it doesn't look like that's what's happening here. Sorry I can't offer any more concrete advice... Maybe try changing to absolute paths? Is this actually in a .htaccess file or did you mean httpd.conf ( which requires a restart after changes ). Let me know if you do figure this out
pickle
Briney Mod
Posts: 6445 Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:
Post
by pickle » Tue Mar 03, 2009 9:46 am
I've got to make this project work on an out-of-the-box distro. This is part of a F/OSS project that I want to be as portable as possible. That includes storing the project in a subdirectory, so absolute urls are out.
I think I can get rid of a lot of the redirection in .htaccess & just use PHP to parse the URL. Not as tidy of course, but if it works...
Thanks for looking.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
semlar
Forum Commoner
Posts: 61 Joined: Fri Feb 20, 2009 10:45 pm
Post
by semlar » Tue Mar 03, 2009 10:04 am
Not that this will fix anything, but most of these are redundant..
Code: Select all
RewriteEngine on
# Main
RewriteRule ^main/ /main.php?main [L]
#Courses, Questions, Responses, Templates
RewriteRule ^(courses|questions|responses|templates)/$ /$1.php?o=id&d=desc [L]
RewriteRule ^(courses|questions|responses|templates)/([^/]+)/([^/]+)/ /$1.php?o=$2&d=$3 [L]
#Reports, Accounts, Logout
RewriteRule ^(reports|accounts|logout)/ /$1.php [L]
# Gains Analysis
RewriteRule ^gains/ /gains_analysis.php [L]
# Web form
RewriteRule ^form/([^/]*) /web_form.php?id=$1 [L]
josh
DevNet Master
Posts: 4872 Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida
Post
by josh » Tue Mar 03, 2009 2:11 pm
pickle wrote: I think I can get rid of a lot of the redirection in .htaccess & just use PHP to parse the URL. Not as tidy of course, but if it works.
I disagree, I think storing the routes as code is cleaner then .htaccess
Pickle, What happens if you comment out all the rules except the relevant one, comment all conditionals and just have 1 rewrite rule with he L flag. Did you try this ( that's how I'd debug regular code, in theory it makes sense to do it the same way here.. )... if that does work re-introduce the other lines until you can deduce what's going on?
pickle
Briney Mod
Posts: 6445 Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:
Post
by pickle » Tue Mar 03, 2009 2:25 pm
Ya, I tried that - no dice.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
josh
DevNet Master
Posts: 4872 Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida
Post
by josh » Tue Mar 03, 2009 3:19 pm
Can you post the rewritelog when you just have the 1 rule? Don't know if I can help but maybe I overlooked something in the huge log you posted previously
semlar
Forum Commoner
Posts: 61 Joined: Fri Feb 20, 2009 10:45 pm
Post
by semlar » Tue Mar 03, 2009 3:28 pm
Um.. the URIs accessed in the log you posted are as follows:
"templates.php/id/asc/"
"templates.php~/id/asc/"
"id/asc/"
None of those are covered by your rewrite rules.
josh
DevNet Master
Posts: 4872 Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida
Post
by josh » Tue Mar 03, 2009 4:14 pm
There must be something that got clipped. These logs usually start with "request initilized with": and then the URI. I'm thinking some other rewrite put the .php in but yes the .php shouldn't be there, the question is where is it coming from
pickle
Briney Mod
Posts: 6445 Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:
Post
by pickle » Tue Mar 03, 2009 4:43 pm
Here's the .htaccess file with 1 rule:
Code: Select all
ErrorDocument 404 404.php
RewriteEngine on
RewriteRule ^templates/(.*)/(.*)/ templates.php?o=$1&d=$2 [L]
Here's the log file:
Code: Select all
xxx.xxx.xxx.xxx - - [03/Mar/2009:15:26:14 --0700] [myserver.com/sid#b8154ef0][rid#b82eee30/subreq] (3) [perdir /var/www/wassail/rewrite/] add path info postfix: /var/www/wassail/rewrite/templates.php -> /var/www/wassail/rewrite/templates.php/blah/hum/
xxx.xxx.xxx.xxx - - [03/Mar/2009:15:26:14 --0700] [myserver.com/sid#b8154ef0][rid#b82eee30/subreq] (3) [perdir /var/www/wassail/rewrite/] strip per-dir prefix: /var/www/wassail/rewrite/templates.php/blah/hum/ -> templates.php/blah/hum/
xxx.xxx.xxx.xxx - - [03/Mar/2009:15:26:14 --0700] [myserver.com/sid#b8154ef0][rid#b82eee30/subreq] (3) [perdir /var/www/wassail/rewrite/] applying pattern '^templates/(.*)/(.*)/' to uri 'templates.php/blah/hum/'
xxx.xxx.xxx.xxx - - [03/Mar/2009:15:26:14 --0700] [myserver.com/sid#b8154ef0][rid#b82eee30/subreq] (1) [perdir /var/www/wassail/rewrite/] pass through /var/www/wassail/rewrite/templates.php
xxx.xxx.xxx.xxx - - [03/Mar/2009:15:26:14 --0700] [myserver.com/sid#b8154ef0][rid#b82ddbd8/initial] (3) [perdir /var/www/wassail/rewrite/] add path info postfix: /var/www/wassail/rewrite/templates.php -> /var/www/wassail/rewrite/templates.php/blah/hum/
xxx.xxx.xxx.xxx - - [03/Mar/2009:15:26:14 --0700] [myserver.com/sid#b8154ef0][rid#b82ddbd8/initial] (3) [perdir /var/www/wassail/rewrite/] strip per-dir prefix: /var/www/wassail/rewrite/templates.php/blah/hum/ -> templates.php/blah/hum/
xxx.xxx.xxx.xxx - - [03/Mar/2009:15:26:14 --0700] [myserver.com/sid#b8154ef0][rid#b82ddbd8/initial] (3) [perdir /var/www/wassail/rewrite/] applying pattern '^templates/(.*)/(.*)/' to uri 'templates.php/blah/hum/'
xxx.xxx.xxx.xxx - - [03/Mar/2009:15:26:14 --0700] [myserver.com/sid#b8154ef0][rid#b82ddbd8/initial] (1) [perdir /var/www/wassail/rewrite/] pass through /var/www/wassail/rewrite/templates.php
This is a result of accessing
http://www.myserver.com/wassail/rewrite ... /blah/hum/ . The file templates.php, as well as the .htaccess file are all in the /wassail/rewrite/ directory. The templates.php file had this in $_SERVER:
Code: Select all
[QUERY_STRING] =>
[REQUEST_URI] => /wassail/rewrite/templates/blah/hum/
[SCRIPT_NAME] => /wassail/rewrite/templates.php
[PATH_INFO] => /blah/hum/
[PATH_TRANSLATED] => /var/www/blah/hum/
[PHP_SELF] => /wassail/rewrite/templates.php/blah/hum/
I should note that I've gone ahead & put the work into code rather than rely on the .htaccess. When there was no immediate/obvious solution (I thought maybe I was just being a bonehead), I had to move on. I've only got 10 more man hours I can commit to this project, so I've got to move on. If you see something obvious though, I'd still be interested to find out what the eff is going on.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
semlar
Forum Commoner
Posts: 61 Joined: Fri Feb 20, 2009 10:45 pm
Post
by semlar » Tue Mar 03, 2009 4:52 pm
Maybe I'm missing something, but it appears to me that your server is turning requests to templates/blah/hum/ into templates.php/blah/hum/ before the rewrite engine even gets to it.
Sort of like a "directory not found, file with similar name, stick it onto the end of that" type of thing.
Actually, come to think of it you are using a custom 404.php page aren't you..
pickle
Briney Mod
Posts: 6445 Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:
Post
by pickle » Tue Mar 03, 2009 5:01 pm
Yes I am using a custom 404 page. That page is just a simple dump that says "file not found". Even when I comment out that line, nothing changes.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
josh
DevNet Master
Posts: 4872 Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida
Post
by josh » Tue Mar 03, 2009 5:04 pm
semlar wrote: Maybe I'm missing something, but it appears to me that your server is turning requests to templates/blah/hum/ into templates.php/blah/hum/ before the rewrite engine even gets to it.
Yes, we're trying to figure out why. Can you grep httpd.conf for php, my theory is there is some other rewrite rule or other plugin. If your rewritelog directive comes after it we would never see it. I agree no solution is evident but I'd still find it neat if we could figure this out.