New Plugin: URLCleaner

Hello all, for those who have pretty urls (clean urls) configured in their Kanboard, this plugin may be useful.

I will release it to the directory once I have accumulated a few more URLs, but the plugin is fully functional and can be installed manually.

At the moment, Bigboard and Wiki are the two plugins I have added routes for.

2 Likes

Version 1 has been released with 47 new clean URLs

Hello all, version 2 has been released. The core routes have been merged into Kanboard from v1.2.28+ so they have been maintained in the plugin for older versions.

If somebody could reply to this thread I can update this post next time (3 consecutive posts per user limit)

Kindly remember to star the repository on GitHub if you find the plugin useful or even consider a donation to maintain the plugin.

Hello aljawaid and thanks for this plugin I’ve been awaiting for a long time.

I don’t know how to purge old URLs though, in order for kanboard to use and display the clean ones :

once enabled, it did so directly for the board links i.e [my_domain]/board/4

but not for the tasks - still using [my_domain]/?controller=TaskViewController&action=show&task_id=828&project_id=4

instead of [my_domain]/t/828 which, when I type it manually in the address bar, works just as well…

I cleared my browser cache but with no more success… any idea or tip ?

Thanks in advance

Hello, what KB version are you using?

I just tested on my v1.2.22 and v1.2.32 - both work fine with the plugin installed.

https://mydomain.com/task/52 is what I get when I click on a board and go to the task through the board.

HI.
I’m using version 1.2.32.
Do you have mod rewrite rules in you htaccess ? if so, could you share the content of the file ? I’ve always been struggling with this one…
My kanboard is hosted on a shared apache server, but I enabled the URL rewriting in the config file with

define('ENABLE_URL_REWRITE', true);

I guess it’d be cleaner to enable it on the server side… and maybe the problem comes from there ?

Do you have mod rewrite rules in you .htaccess ? if so, could you share the content of the file ?

KB v1.2.22 for https://domain.com

# Pass HTTP Authorization header via environment variable to PHP backend
# to make HTTP Basic Authentication work for Apache/FastCGI/php-fpm
# setups (required to authenticate over the API)
<IfModule mod_setenvif.c>
    SetEnvIf Authorization .+ HTTP_AUTHORIZATION=$0
</IfModule>

<IfModule mod_rewrite.c>
    Options -MultiViews


    <IfModule mod_env.c>
        SetEnv HTTP_MOD_REWRITE On
    </IfModule>
    

    # Uncomment this line depending of your Apache configuration
    # RewriteBase /

    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [QSA,L]
    
    ############################
    ## Uncomment the two lines below to enable force HTTPS capabilities
    ############################
    
    # RewriteCond %{HTTPS} !=on 
    # RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
</IfModule>

<IfModule pagespeed_module>
    ModPagespeed Off
</IfModule>

Header set Content-Security-Policy "default-src 'self' *.cloudflare.com *.customdomain.com 'unsafe-inline'; script-src *.customdomain.com 'self' 'unsafe-inline' https; connect-src 'self'; img-src 'self' data:; style-src 'unsafe-inline' https *; base-uri 'self'; form-action 'self'; frame-src 'self' *.customdomain.com https; child-src 'self' www..customdomain.com;"

KB v1.2.32 for https://my.domain.com

# Pass HTTP Authorization header via environment variable to PHP backend
# to make HTTP Basic Authentication work for Apache/FastCGI/php-fpm
# setups (required to authenticate over the API)
<IfModule mod_setenvif.c>
    SetEnvIf Authorization .+ HTTP_AUTHORIZATION=$0
</IfModule>

<IfModule mod_rewrite.c>
    Options -MultiViews


    <IfModule mod_env.c>
        SetEnv HTTP_MOD_REWRITE On
    </IfModule>
    

    # Uncomment this line depending of your Apache configuration
    # RewriteBase /

    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [QSA,L]
    
    ############################
    ## Uncomment the two lines below to enable force HTTPS capabilities
    ############################
    
    # RewriteCond %{HTTPS} !=on 
    # RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
</IfModule>

<IfModule pagespeed_module>
    ModPagespeed Off
</IfModule>

Header set Content-Security-Policy "default-src 'self' *.cloudflare.com *.customdomain.com 'unsafe-inline'; script-src *.customdomain.com 'self' 'unsafe-inline' https; connect-src 'self' *.customdomain.com; img-src 'self' data: *.unsplash.com *.customdomain.com; style-src 'unsafe-inline' https *; base-uri 'self'; form-action 'self'; frame-src 'self' *.customdomain.com https; child-src 'self' www.customdomain.com;"

Besides the above setting, you also need http_mod_rewrite set to On on the server side. The screenshot below is from KanboardSupport

Hi !
here’s the info displayed by KanboardSupport plugin on my installation.

HTTP_MOD_REWRITE was already enabled in my config.php file, so my settings seem to be okay ?
and as I stated earlier, the rewritten URLs do work fine, but not in use… (apart from the board links)
I still don’t get it…

Check that the apache module mod_rewrite is installed in your php:

The screenshot is from KanboardSupport (unreleased version). I will release the version soon but you can also check through the usual phpinfo methods.

Hello,
the URL rewrite module is installed and working in Apache, since the URL rewriting is working fine on the board URL link, as I stated in my first post, and - since Apache modules don’t show up in php info file when PHP is running as FastCGI - I also tested it again by adding temporarily to my .htaccess file the following line (right after “RewriteEngine On”)

RewriteRule .* my_test_file.php

And it worked indeed.

That’s why I was wondering if there’s no cache folder to be cleaned. Or URLs stored in db or whatever ?

Also, I noticed in the web.config file of my web server the following code :

<rewrite>
            <rules>
                <rule name="Kanboard URL Rewrite" stopProcessing="true">
                    <match url="^(.*)$" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="index.php" appendQueryString="true" />
                </rule>
            </rules>
        </rewrite>

Is it plugin-related ?

Thanks for the information, useful to know.

Is it plugin-related ?

  • No, I’m confident it is not. The plugin does not do anything to the web.config file - I think it is KB related.

Hello again,
I finally found out that the issue was caused by the CardPushDate plugin.
Problem solved !

2 Likes

I just want to say thank you, thank you, thank you, thank you. You rule. Thank you for this plugin and also thank you for KanboardSupport. etc.

Seriously, you are a beautiful person for contributing so many useful things to this great project. Thank you.