Jump to content

Cms Plugin: Multicompanies - Missing Redirection For Non Existing Url


serge

Recommended Posts

The bug was explained here:  http://www.blesta.com/forums/index.php?/topic/4152-blesta-cms-issue-bug/#entry30717

 

---------------

 

all pages are 100% powered by Blesta CMS on a single install.

 

This company work fine:

-------------------------------

 

http://siteshop.ph/

 

 

BUT this company have an issue:

-------------------------------------

 

http://netpublica.com/

 

because if you type anything at the ending of url, like this:

 

http://netpublica.com/MY-RANDOM-STRING

 

"MY-RANDOM-STRING" will stay at end of URL, it's do not redirect to netpublica.com like it do well for the first company if you try same way.

--------

 

 

The bugs was reproductable on 2 servers (production, dev),

 

To reproduce the bug, just create 2 companies configure them, use the portal plugin on both, & check URL same way as described above.

Link to comment
Share on other sites

As I mentioned in the other thread, I wasn't able to duplicate this behavior. Did you make any customizations to the site, .htaccess, routing, etc.?

 

I believe they are using the admin tools plugin to do it. I edit the config/routes.php file myself for mine. But I don't use Multi-Company.

Link to comment
Share on other sites

thxs I missed your answer on support forum section.

 

no admin tool used.

 

Maybe it's because Blesta is physically installed at public_html (no sub dir) ?

 

And Yes there is customization in template as well as in the CMS plugin:

http://www.blesta.com/forums/index.php?/topic/2943-blesta-32-how-to-make-static-pages-by-modifying-portal-plugin/?hl=static+page

 

in above link I was saying how port Rodrigo hack, for it's work on multi company.  I could try to remove that to re-check again, how "bug" is reproduce or not, thxs

Link to comment
Share on other sites

ok, using this original (no customization) file, remove the "bug"

 

    /plugins/cms/controllers/main.php

 

Sorry, for false info.

 

will be nice if next plugin like admin tool & add page can create meta tag by page, it's will prevent me to hack in the code of CMS plugin.

 

I will be re-checking my customization, and if not will be doing a redirection / or rewritte rule at webserver

Link to comment
Share on other sites

Ok, I found the issue in the above link (Rodrigo hack) I given:

 

Rodrigo said:

1.1 Creating a static page with custom HTML
 
1. Open plugins/cms/controller/main.php
Find:

else {
  $this->redirect($this->base_uri);
}

Replace for:

else {
                        switch($uri) {
                          case 'services':
                            $this->structure->set("page_title", "*** INSERT PAGE TITLE ***");
                            $this->structure->set("title", "*** INSERT TITLE SHOWN ON PORTAL TEMPLATE ***");
                            // Placeholders won't work with this method, so let's use variables
                            $url = rtrim($this->base_url, "/");
                            $blesta_url = $this->Html->safe($url . WEBDIR);
                            $html = <<<EOT
 

    <div class="col-md-4 col-sm-6 portal-box">
        <a href="{$blesta_url}services>
            <div class="well">
                <i class="fa fa-cogs fa-4x"></i>
                <h4>Foo</h4>
                <p>Bar.</p>
            </div>
        </a>
    </div>

 
 
EOT;
                            $this->set("content", $html);
                            break;
                          default: 
                              $this->redirect($this->base_uri);
                        } 
}

You can repeat the php case for making all the static pages you want, putting HTML between the EOT marks (There should be no space or characters after EOT; mark). If you don't like the broken indentation you can try another methods for doing multi line strings in PHP, but I think using nowdoc is more easy when you need to insert html.

BUT Just before the closing of " else { "      at bottom, you is still need to redirect for other (unknown URL case) to  base_uri

 

 

---------------------

// IF NONE OF ABOVE CASE OR COMPANY REDIRECT TO BASE URI
  $this->redirect($this->base_uri);


      
}  // END:    ELSE
 

 

------------------------

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...