Method to hide /public/ folder from URL?

Get help using, installing and / or configuring The Bug Genie here
Post Reply
virtualdavid
Posts: 17
Joined: Thu Mar 10, 2016 12:30 am

Method to hide /public/ folder from URL?

Post by virtualdavid » Sat Mar 26, 2016 2:41 am

I'm wondering if following the instructions for 3.x summarized below from an archived post, will create a clean url (hide the /public/) = buggenie.mydomain.org and not mess up security or the auto-mailing function in v4.1? Here is the orginal post's link: http://archive.forum.thebuggenie.org/vi ... etup#p5857

Summary of post "How i totally owned my TBG setup" by sergiorcs
NOTE: I'm assuming "thebuggenie" can be replaced with "public" if this code is still workable.

Add this line at the top of "thebuggenie/index.php":

Code: Select all

    $_SERVER['PHP_SELF'] = $_SERVER['SCRIPT_NAME'] = '/index.php';
To make "subdomain.example.com/thebuggenie" become "subdomain.example.com" add this to an htaccess located at the root of the subdomain:

Code: Select all

    ErrorDocument 403 /thebuggenie/index.php
    ErrorDocument 404 /thebuggenie/index.php

    <IfModule mod_rewrite.c>
       RewriteEngine On
       RewriteBase /

       RewriteRule ^(.*)$ /thebuggenie/$1 [L]
    </IfModule>
AND modify "thebuggenie/htaccess" to look like this:

Code: Select all

    <IfModule mod_php5.c>
       php_flag magic_quotes_gpc off
       php_flag register_globals off
    </IfModule>

    <IfModule mod_rewrite.c>
       RewriteEngine On
       RewriteBase /thebuggenie/

       RewriteCond %{REQUEST_URI} ^\..+$
       RewriteRule .* - [L]

       RewriteCond %{REQUEST_FILENAME} !-d
       RewriteCond %{REQUEST_FILENAME} !-f
       RewriteCond %{REQUEST_FILENAME} !-l
       RewriteRule ^(.*)$ index.php?url=$1 [NC,QSA,L]
    </IfModule>
The rest is a direct quote as it contained interesting findings and fixes by sergiorcs that didn't seem right to summarize:

QUOTE

Now came the hardest bit: getting email queueing to work.
It took me a long time to figure out why i got some "HTTP_HOST" error messages from my cron job. The "php -q" suggestion i found somewhere didn't work either.
The problem is that PHP_SAPI returned by my server is not 'cli', but 'cgi-fcgi'. So, to get around this, i had to modify "core/classes/TBGContext.class.php" as follows:
@@ -2581,4 +2581,4 @@
public static function isCLI()
{
- return (PHP_SAPI == 'cli');
+ return defined('TBG_CLI') && TBG_CLI;
}
After that, the cron job no longer returned an error, but i got these suspicious messages:
Processing mail queue ...
Email(s) to process: 3
Not processing queue...
I solved this by removing the SERVERNAME from the command: "php /path/to/tbg_cli mailing:process_mail_queue subdomain.example.com --limit=10 > /dev/null" -> "php /path/to/tbg_cli mailing:process_mail_queue --limit=10 > /dev/null". TBG's guide on Delayed Mailing mislead me. Is SERVERNAME only to be used with scopes?
After that, the suspicious message went away:
Processing mail queue ...
Email(s) to process: 3
Emails successfully processed: 3
The Bug Genie is an awesome (and free!!!) piece of software - i though i'd give something back. Hopefully, these tips may prove helpful to someone.

END QUOTE

So, will this code work to hide the /public/ folder from the url?

Thanks for any help! Cheers! David

virtualdavid
Posts: 17
Joined: Thu Mar 10, 2016 12:30 am

Re: Method to hide /public/ folder from URL?

Post by virtualdavid » Thu Jun 16, 2016 8:20 pm

Could the hiding /public/ in the url be part of the install process where the user is asked if The Bug Genie is being installed in its own subdomain folder? Should I add this as an enhancement idea?

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests