How to enable Rewrite Rules (Disabled by CyberPanel)

Hello Everyone,
I am facing one issue with Cyberpanel’s Openlitespeed and nuxt-js app via proxy. the domain is not redirecting to www and HTTPS.
Same thing I have tested on the local machine’s Openlitespeed without Cyberpanel. it’s working fine.

I have searched the string via command grep -iRl “Disabled by CyberPanel” /usr/local/lsws/
and I found one file that has functions Disabled by CyberPanel (/usr/local/lsws/admin/html/lib/ows/DTblDef.php)

Can I comment below function for enabling the Rewrite Rules?

**protected function add_VT_REWRITE_MAP($id)**
    {
        $parseFormat = "/^((txt|rnd):\/*)|(int:(toupper|tolower|escape|unescape))$/";
        $name = self::NewTextAttr('name', DMsg::ALbl('l_name'), 'name', false, 'rewriteMapName');
        $location = self::NewParseTextAttr('location', DMsg::ALbl('l_location'), $parseFormat, DMsg::ALbl('parse_rewritemaplocation'), true, 'rewriteMapLocation');
        $note = $this->_attrs['note']->dup(null,null,null);
        $name->cyberpanelBlocked = true;
        $location->cyberpanelBlocked = true;
        $note->cyberpanelBlocked = true;

        $attrs = [
            $name,
            $location,
            $note,
        ];
        $label = DMsg::ALbl('l_rewritemap');
        if (PathTool::IsCyberPanel()) {
            $label .= ' (Disabled by CyberPanel)';
        }
        $this->_tblDef[$id] = DTbl::NewIndexed($id, $label, $attrs, 'name');
    }

    **protected function add_VT_REWRITE_RULE($id)**
    {
        $rules = self::NewTextAreaAttr('rules', null, 'cust', true, 5, null, 1, 1);
        $rules->cyberpanelBlocked = true;
        $attrs = array(
            $rules
        );
        $label = DMsg::ALbl('l_rewriterules');
        if (PathTool::IsCyberPanel()) {
            $label .= ' (Disabled by CyberPanel)';
        }
        $this->_tblDef[$id] = DTbl::NewRegular($id, $label, $attrs, 'rewriteRules', 1);
    }

Thanks

Resolved the issue by making in following functions in file /usr/local/lsws/admin/html/lib/ows/DTblDef.php
Hope this will help others well.


protected function add_VT_REWRITE_MAP_TOP($id)
    {
        $align = ['left', 'left', 'center'];
        $name = self::NewViewAttr('name', DMsg::ALbl('l_name'));
        $location = self::NewViewAttr('location', DMsg::ALbl('l_location'));
        $action = self::NewActionAttr('VT_REWRITE_MAP', 'Ed');
        $name->cyberpanelBlocked = false;
        $location->cyberpanelBlocked = false;
        $action->cyberpanelBlocked = false;
        $label = DMsg::ALbl('l_rewritemap');
        if (PathTool::IsCyberPanel()) {
           // $label .= ' (Disabled by CyberPanel)';
        }
        $attrs = [
            $name,
            $location,
            $action
        ];
        $this->_tblDef[$id] = DTbl::NewTop($id, $label, $attrs, 'name', 'VT_REWRITE_MAP', $align, null, 'redirect', true);
    }

    protected function add_VT_REWRITE_MAP($id)
    {
        $parseFormat = "/^((txt|rnd):\/*)|(int:(toupper|tolower|escape|unescape))$/";
        $name = self::NewTextAttr('name', DMsg::ALbl('l_name'), 'name', false, 'rewriteMapName');
        $location = self::NewParseTextAttr('location', DMsg::ALbl('l_location'), $parseFormat, DMsg::ALbl('parse_rewritemaplocation'), true, 'rewriteMapLocation');
        $note = $this->_attrs['note']->dup(null,null,null);
        $name->cyberpanelBlocked = false;
        $location->cyberpanelBlocked = false;
        $note->cyberpanelBlocked = false;

        $attrs = [
            $name,
            $location,
            $note,
        ];
        $label = DMsg::ALbl('l_rewritemap');
        if (PathTool::IsCyberPanel()) {
           // $label .= ' (Disabled by CyberPanel)';
        }
       
        $this->_tblDef[$id] = DTbl::NewIndexed($id, $label, $attrs, 'name');
    }

    protected function add_VT_REWRITE_RULE($id)
    {
        $rules = self::NewTextAreaAttr('rules', null, 'cust', true, 5, null, 1, 1);
        $rules->cyberpanelBlocked = false;
        $attrs = array(
            $rules
        );
        $label = DMsg::ALbl('l_rewriterules');
        if (PathTool::IsCyberPanel()) {
            //$label .= ' (Disabled by CyberPanel)';
        }
        $this->_tblDef[$id] = DTbl::NewRegular($id, $label, $attrs, 'rewriteRules', 1);
    }
2 Likes

This topic was automatically closed 3 hours after the last reply. New replies are no longer allowed.