summaryrefslogtreecommitdiff
path: root/doc/en_US/nice-urls.markdown
blob: a054e85d5dff2a9938dd89d44df64c4c3e42bbf6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
URL rewriting
=============

Kanboard is able to work indifferently with URL rewriting enabled or not.

- Example of URL rewritten: `/board/123`
- Otherwise: `?controller=board&action=show&project_id=123`

If you use Kanboard with Apache and with the mode rewrite enabled, nice URLs will be used automatically.
In case you get a "404 Not Found", you might need to set at least the following overrides for your DocumentRoot to get the .htaccess files working:

```sh
<Directory /var/www/kanboard/>
	AllowOverride FileInfo Options=All,MultiViews AuthConfig
</Directory>
```

URL Shortcuts
-------------

- Go to the task #123: **/t/123**
- Go to the board of the project #2: **/b/2**
- Go to the project calendar #5: **/c/5**
- Go to the list view of the project #8: **/l/8**
- Go to the project settings for the project id #42: **/p/42**

Configuration
-------------

By default, Kanboard will check if the Apache mode rewrite is enabled.

To avoid the automatic detection of URL rewriting from the web server, you can enable this feature in your config file:

```php
define('ENABLE_URL_REWRITE', true);
```

When this constant is at `true`:

- URLs generated from command line tools will be also converted
- If you use another web server than Apache, by example Nginx or Microsoft IIS, you have to configure yourself the URL rewriting

Note: Kanboard always fallback to old school URLs when it's not configured, this configuration is optional.

Nginx configuration example
---------------------------

In the section `server` of your Nginx config file you can use this example:

```bash
index index.php;

location / {
    try_files $uri $uri/ /index.php$is_args$args;

    # If Kanboard is under a subfolder
    # try_files $uri $uri/ /kanboard/index.php;
}

location ~ \.php$ {
    try_files $uri =404;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_index index.php;
    include fastcgi_params;
}

# Deny access to the directory data
location ~* /data {
    deny all;
    return 404;
}

# Deny access to .htaccess
location ~ /\.ht {
    deny all;
    return 404;
}
```

In your Kanboard `config.php`:

```php
define('ENABLE_URL_REWRITE', true);
```

Another example with Kanboard in a subfolder:

```
server {
    listen 443 ssl default_server;
    listen [::]:443 ssl default_server;

    root /var/www/html;
    index index.php index.html index.htm;
    server_name _;

    location / {
        try_files $uri $uri/ =404;
    }

    location ^~ /kanboard {

        location /kanboard {
            try_files $uri $uri/ /kanboard/index.php$is_args$args;
        }

        location ~ ^/kanboard/(?:kanboard|config.php|config.default.php) {
            deny all;
        }

        location ~* /kanboard/data {
            deny all;
        }

        location ~ \.php(?:$|/) {
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_param PATH_INFO $fastcgi_path_info;
            fastcgi_param HTTPS on; # Use only if HTTPS is configured
            include fastcgi_params;
            fastcgi_pass unix:/var/run/php5-fpm.sock;
        }

        location ~ /kanboard/\.ht {
            deny all;
        }
    }
}
```

Adapt the example above according to your own configuration.

IIS configuration example
-------------------------

1. Download and install the Rewrite module for IIS: [Download link](http://www.iis.net/learn/extensions/url-rewrite-module/using-the-url-rewrite-module)
2. Create a web.config in you installation folder:

```xml
<?xml version="1.0"?>
<configuration>
    <system.webServer>
        <defaultDocument>
            <files>
                <clear />
                <add value="index.php" />
            </files>
        </defaultDocument>
        <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>
    </system.webServer>
</configuration>
```

In your Kanboard `config.php`:

```php
define('ENABLE_URL_REWRITE', true);
```

Adapt the example above according to your own configuration.