Redirect Context adds "index.php" ???

Discussion in 'General OpenLiteSpeed Discussion' started by enthess, Nov 2, 2016.

  1. enthess

    enthess Member

    Hello,

    I am trying to add a Redirect Context for "old.example.org" => "new.example.org", and i have this in my Redirect Context

    URI : /
    External: Yes
    Status code: 301
    Dest URI: http://new.example.org/

    And, it works, i end up with a redirect, but i land on "new.example.org/index.php", which does not exist. (index.html exists thou).

    What am i doing wrong??
     
  2. lsfoo

    lsfoo Administrator

    Hi Enthess,

    Could you check your indexFiles setting? Does it have both index.php and index.html listed?
     
  3. enthess

    enthess Member

    On where? the old, the new?
    I know server general has both index.php and index.html

    The new has
    use server : no
    index: index.html

    old has
    use server : no
    index : index.php
     
    Last edited: Nov 2, 2016
  4. enthess

    enthess Member

    Also, if i edit destination URL to => new.example.org/index.html , it resolves it as new.example.org/index.htmlindex.php :(
     
  5. enthess

    enthess Member

    I found the solution!

    Turn off Rewrite on "old" vhost.

    Rewrite:
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule . index.php [L]
     
  6. lsfoo

    lsfoo Administrator

    Enthess,

    Are those rewrite rules also in the new vhost?
     
  7. enthess

    enthess Member

    On new vhost i have these

    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule . /api/public/index.php [L]

    I have an API-framework in /api/public/ which i want it to listen for /api/-calls

    Maybe rewriterule should be .^/api/ /api/public/index.php or something instead?
     
  8. lsfoo

    lsfoo Administrator

    Could you set rewrite logging to 9 on the new? It should say what URI the rule tried to switch from.
     
  9. enthess

    enthess Member

    On the new vhost with old rewrite activated, i got this:

    2016-11-02 16:25:07.684 [INFO] [:55840] [REWRITE] Rule: Match '/index.htmlindex.php' with pattern '.', result: 1
    2016-11-02 16:25:07.684 [INFO] [:55840] [REWRITE] stat( /usr/local/lsws/vvDashboard/index.htmlindex.php ) failed
    2016-11-02 16:25:07.684 [INFO] [:55840] [REWRITE] stat( /usr/local/lsws/vvDashboard/index.htmlindex.php ) failed
    2016-11-02 16:25:07.684 [INFO] [:55840] [REWRITE] Source URI: '/index.htmlindex.php' => Result URI: '/api/public/index.php'
    2016-11-02 16:25:07.684 [INFO] [:55840] [REWRITE] Last Rule, stop!
     
  10. lsfoo

    lsfoo Administrator

    I see. So it looks like the redirect context got the old rewrites prior to redirecting. If those rewrite rules are not necessary, then turning them off should be sufficient.

    Thanks for the heads up, we'll look into this :)
     
  11. enthess

    enthess Member

    Its not needed no more, its a 301-permanent redirect and i see no reason of why rewrite should be activated anymore. :)
     

Share This Page