Rewrite rules issue using PHPIPAM on OLS

Discussion in 'Linux Support: Debian, Ubuntu, SolusOS etc' started by Majestic, Apr 23, 2016.

  1. Majestic

    Majestic New Member

    Hi Guys,

    I earlier posted this on the other website (litespeedtech.com) but I wasnt aware/noticed that the other site is for the commerical product and so I have added it here to get the appropriate support.

    Sorry to bother you but I am having an issue with configuring a web application (PHPIPAM) which I usully have it installed on Apache and I wondered if someone could point the issue out to me as I expect its to do with the rules. I don't really want to switch back to apache just because of this.

    The name of the software is PHPIPAM and can be obtained from here http://phpipam.net/documents/download-phpipam/

    It uses a .htaccess file file to setup some rewrite rules and one of them is the RewriteBase rule which I understand can't be added into open litespeeds rewrite box due to RewriteBase is not a vhost config/setting.

    I have added the rewrite rules into the OLS Admin Panel under static context and then added the RewriteBase into the box above the rewrite rules. It seems to ignore the rewrite base completly and I half suspect its either a bug or what I am using in the URL and location boxes are wrong. I am currently using the URL in both boxes but I have tried several different settings but none seem to be working.

    The below code is taken from the .htaccess file directly..

    Code:
    RewriteEngine on
    
    # change rewrite base if not in root
    RewriteBase /ipam
    
    # passthroughs
    RewriteRule ^api/.$ - [L]
    RewriteRule ^index.php$ - [L]
    RewriteRule ^(css|js|site|test)/.*$ - [L]
    RewriteRule site/login/captcha/captchashow.php - [L]
    
    # redirect errors
    ErrorDocument 400 /error/400/
    ErrorDocument 401 /error/401/
    ErrorDocument 403 /error/403/
    ErrorDocument 404 /error/404/
    ErrorDocument 500 /error/500/
    
    # IE login dashboard fix
    RewriteRule ^login/dashboard/$ dashboard/ [R]
    RewriteRule ^logout/dashboard/$ dashboard/ [R]
    # search override
    RewriteRule ^tools/search/(.*)/(.*)/(.*)/(.*)/(.*)$ index.php?page=tools&section=search&addresses=$1&subnets=$2&vlans=$3&vrf=$4&ip=$5 [L]
    
    # Rewrites
    RewriteRule ^(.*)/(.*)/(.*)/(.*)/(.*)/$ index.php?page=$1&section=$2&subnetId=$3&sPage=$4&ipaddrid=$5 [L]
    RewriteRule ^(.*)/(.*)/(.*)/(.*)/$ index.php?page=$1&section=$2&subnetId=$3&sPage=$4 [L]
    RewriteRule ^(.*)/(.*)/(.*)/$ index.php?page=$1&section=$2&subnetId=$3 [L]
    RewriteRule ^(.*)/(.*)/$ index.php?page=$1&section=$2 [L]
    RewriteRule ^(.*)/$ index.php?page=$1 [L]
    I have removed the RewriteBase and added that just in the box above on OLS admin pannel. I have also tried to add in slashs (/) infront of the rules and also have removed the ErrorDocument as they were showing up as errors in the logs.

    I am at a loss on trying to get this to work. I have also tried to remove all rules and just try to get JUST the rewriteBase to work in the box above and it doesnt work. The rewrite rules are turned on, but it seems to ignore it.

    Any ideas what I maybe doing wrong? I would be extreamly greatful as I don't really want o switch back to nginx+phpfpm based solution or run apache as a backened to OLS.

    Thanks in advance.
     
  2. lsfoo

    lsfoo Administrator

    Hi Majestic,

    My apologies for such a late response, I didn't get a notification for this message.

    Could you enable debug logging and rewrite logging (set log level to 9) and try to access the page? The log should tell us what is happening with regards to the rewrite rules.

    Also, please send us the log. If you'd rather not paste it here, send it to me at kfwu at litespeedtech dot com and I'll look it over.

    Cheers,
    Kevin
     
  3. Majestic

    Majestic New Member

    Thank you for the reply and no worries.

    I have spoken to the main forum and have resolved the issue with them.

    Problems now resolved. Sorry for the noise.
     
  4. lsfoo

    lsfoo Administrator

    OK good. Glad your issue was resolved!
     

Share This Page