rewrite issue

Discussion in 'Install/Configuration' started by accassar, Apr 27, 2012.

  1. accassar

    accassar New Member

    url: http://test.com/category/library

    results in PHP 'no input file specified error'

    url: http://test.com/index.php/category/library works

    .htaccess rewrite rules:

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

    RewriteCond %{REQUEST_URI} ^application.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]
    </IfModule>

    <IfModule mod_rewrite.c>
    RewriteCond %{HTTPS} !=on
    RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
    RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
    </IfModule>

    <IfModule mod_rewrite.c>
    RewriteRule "(^|/)\." - [F]
    </IfModule>

    logs:

    2012-04-27 15:47:48.472 [INFO] [127.0.0.1:33137-0#test.com] [REWRITE] strip base: '/' from URI: '/category/library'
    2012-04-27 15:47:48.472 [INFO] [127.0.0.1:33137-0#test.com] [REWRITE] Rule: Match 'category/library' with pattern '^(.*)$', result: 2
    2012-04-27 15:47:48.472 [INFO] [127.0.0.1:33137-0#test.com] [REWRITE] Cond: Match '/category/library' with pattern '^system.*', result: -1
    2012-04-27 15:47:48.472 [INFO] [127.0.0.1:33137-0#test.com] [REWRITE] Rule: Match 'category/library' with pattern '^(.*)$', result: 2
    2012-04-27 15:47:48.472 [INFO] [127.0.0.1:33137-0#test.com] [REWRITE] Cond: Match '/category/library' with pattern '^application.*', result: -1
    2012-04-27 15:47:48.472 [INFO] [127.0.0.1:33137-0#test.com] [REWRITE] Rule: Match 'category/library' with pattern '^(.*)$', result: 2
    2012-04-27 15:47:48.472 [INFO] [127.0.0.1:33137-0#test.com] [REWRITE] stat( /clientdata/apache-www/s/h/test.com/www/category ) failed
    2012-04-27 15:47:48.472 [INFO] [127.0.0.1:33137-0#test.com] [REWRITE] stat( /clientdata/apache-www/s/h/test.com/www/category ) failed
    2012-04-27 15:47:48.472 [INFO] [127.0.0.1:33137-0#test.com] [REWRITE] Source URI: 'category/library' => Result URI: 'index.php/category/library'
    2012-04-27 15:47:48.472 [INFO] [127.0.0.1:33137-0#test.com] [REWRITE] Last Rule, stop!
    2012-04-27 15:47:48.472 [INFO] [127.0.0.1:33137-0#test.com] [REWRITE] prepend rewrite base: '/', final URI: '/index.php/category/library'
    2012-04-27 15:47:48.472 [INFO] [127.0.0.1:33137-0#test.com] [REWRITE] strip base: '/' from URI: '/index.php/category/library'
    2012-04-27 15:47:48.472 [INFO] [127.0.0.1:33137-0#test.com] [REWRITE] Rule: Match 'index.php/category/library' with pattern '^(.*)$', result: 2
    2012-04-27 15:47:48.472 [INFO] [127.0.0.1:33137-0#test.com] [REWRITE] Cond: Match '/index.php/category/library' with pattern '^system.*', result: -1
    2012-04-27 15:47:48.472 [INFO] [127.0.0.1:33137-0#test.com] [REWRITE] Rule: Match 'index.php/category/library' with pattern '^(.*)$', result: 2
    2012-04-27 15:47:48.472 [INFO] [127.0.0.1:33137-0#test.com] [REWRITE] Cond: Match '/index.php/category/library' with pattern '^application.*', result: -1
    2012-04-27 15:47:48.472 [INFO] [127.0.0.1:33137-0#test.com] [REWRITE] Rule: Match 'index.php/category/library' with pattern '^(.*)$', result: 2
    2012-04-27 15:47:48.472 [INFO] [127.0.0.1:33137-0#test.com] [REWRITE] Cond: test '/clientdata/apache-www/s/h/test.com/www/index.php' with pattern '-f', result: 0
    2012-04-27 15:47:48.472 [INFO] [127.0.0.1:33137-0#test.com] [REWRITE] Rule: Match 'index.php/category/library' with pattern '^(.*)$', result: 2
    2012-04-27 15:47:48.472 [INFO] [127.0.0.1:33137-0#test.com] [REWRITE] Cond: Compare 'off' with pattern 'on', result: -1
    2012-04-27 15:47:48.472 [INFO] [127.0.0.1:33137-0#test.com] [REWRITE] Cond: Match 'test.com' with pattern '^www\.(.+)$', result: -1
    2012-04-27 15:47:48.472 [INFO] [127.0.0.1:33137-0#test.com] [REWRITE] Rule: Match 'index.php/category/library' with pattern '(^|/)\.', result: -1
    2012-04-27 15:47:48.472 [INFO] [127.0.0.1:33137-0#test.com] [REWRITE] strip base: '/' from URI: '/index.php/category/library'
    2012-04-27 15:47:48.472 [INFO] [127.0.0.1:33137-0#test.com] [REWRITE] Rule: Match 'index.php/category/library' with pattern '^(.*)$', result: 2
    2012-04-27 15:47:48.472 [INFO] [127.0.0.1:33137-0#test.com] [REWRITE] Cond: Match '/index.php/category/library' with pattern '^system.*', result: -1
    2012-04-27 15:47:48.472 [INFO] [127.0.0.1:33137-0#test.com] [REWRITE] Rule: Match 'index.php/category/library' with pattern '^(.*)$', result: 2
    2012-04-27 15:47:48.472 [INFO] [127.0.0.1:33137-0#test.com] [REWRITE] Cond: Match '/index.php/category/library' with pattern '^application.*', result: -1
    2012-04-27 15:47:48.472 [INFO] [127.0.0.1:33137-0#test.com] [REWRITE] Rule: Match 'index.php/category/library' with pattern '^(.*)$', result: 2
    2012-04-27 15:47:48.472 [INFO] [127.0.0.1:33137-0#test.com] [REWRITE] Cond: test '/clientdata/apache-www/s/h/test.com/www/index.php' with pattern '-f', result: 0
    2012-04-27 15:47:48.472 [INFO] [127.0.0.1:33137-0#test.com] [REWRITE] Rule: Match 'index.php/category/library' with pattern '^(.*)$', result: 2
    2012-04-27 15:47:48.473 [INFO] [127.0.0.1:33137-0#test.com] [REWRITE] Cond: Compare 'off' with pattern 'on', result: -1
    2012-04-27 15:47:48.473 [INFO] [127.0.0.1:33137-0#test.com] [REWRITE] Cond: Match 'test.com' with pattern '^www\.(.+)$', result: -1
    2012-04-27 15:47:48.473 [INFO] [127.0.0.1:33137-0#test.com] [REWRITE] Rule: Match 'index.php/category/library' with pattern '(^|/)\.', result: -1
  2. NiteWave

    NiteWave Administrator

    how about change
    to

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?$1 [L]
    </IfModule>
  3. accassar

    accassar New Member

    Thanks that worked. Why doesn't it work with the '/' but with the '?' ?

    I have a large number of virtualhosts to convert and am worried about little rewrite issues like this.
  4. NiteWave

    NiteWave Administrator

    good news. have you tried on apache? if not working under apache, then the rewriterule not written properly.
  5. accassar

    accassar New Member

    yes the rewrite rule worked on apache.

    why did the ? work and not the /, i imaging it's a fairly common rewrite?

Share This Page