Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for nice url rewriting via htaccess #49

Open
wants to merge 1 commit into
base: master
from
Open
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.
+117 −0
Diff settings

Always

Just for now

Copy path View file
@@ -20,6 +20,9 @@ ENV APACHE_HTTPS_PORT_NUMBER="443" \
DOKUWIKI_WIKI_NAME="Bitnami DokuWiki" \
PATH="/opt/bitnami/apache/bin:/opt/bitnami/php/bin:$PATH"

# Modify .htaccess to support nice url rewriting
COPY conf/.htaccess /opt/bitnami/dokuwiki/

EXPOSE 80 443

ENTRYPOINT ["/app-entrypoint.sh"]
Copy path View file
@@ -0,0 +1,43 @@
## You should disable Indexes and MultiViews either here or in the
## global config. Symlinks maybe needed for URL rewriting.
#Options -Indexes -MultiViews +FollowSymLinks

## make sure nobody gets the htaccess, README, COPYING or VERSION files
<Files ~ "^([\._]ht|README$|VERSION$|COPYING$)">
<IfModule mod_authz_host>
Require all denied
</IfModule>
<IfModule !mod_authz_host>
Order allow,deny
Deny from all
</IfModule>
</Files>

## Don't allow access to git directories
<IfModule alias_module>
RedirectMatch 404 /\.git
</IfModule>

## Uncomment these rules if you want to have nice URLs using
## $conf['userewrite'] = 1 - not needed for rewrite mode 2
RewriteEngine on

RewriteRule ^_media/(.*) lib/exe/fetch.php?media=$1 [QSA,L]
RewriteRule ^_detail/(.*) lib/exe/detail.php?media=$1 [QSA,L]
RewriteRule ^_export/([^/]+)/(.*) doku.php?do=export_$1&id=$2 [QSA,L]
RewriteRule ^$ doku.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) doku.php?id=$1 [QSA,L]
RewriteRule ^index.php$ doku.php

## Not all installations will require the following line. If you do,
## change "/dokuwiki" to the path to your dokuwiki directory relative
## to your document root.
#RewriteBase /dokuwiki

## If you enable DokuWikis XML-RPC interface, you should consider to
## restrict access to it over HTTPS only! Uncomment the following two
## rules if your server setup allows HTTPS.
#RewriteCond %{HTTPS} !=on
#RewriteRule ^lib/exe/xmlrpc.php$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R=301]
Copy path View file
@@ -20,6 +20,9 @@ ENV APACHE_HTTPS_PORT_NUMBER="443" \
DOKUWIKI_WIKI_NAME="Bitnami DokuWiki" \
PATH="/opt/bitnami/apache/bin:/opt/bitnami/php/bin:$PATH"

# Modify .htaccess to support nice url rewriting
COPY conf/.htaccess /opt/bitnami/dokuwiki/

EXPOSE 80 443

ENTRYPOINT ["/app-entrypoint.sh"]
Copy path View file
@@ -0,0 +1,43 @@
## You should disable Indexes and MultiViews either here or in the
## global config. Symlinks maybe needed for URL rewriting.
#Options -Indexes -MultiViews +FollowSymLinks

## make sure nobody gets the htaccess, README, COPYING or VERSION files
<Files ~ "^([\._]ht|README$|VERSION$|COPYING$)">
<IfModule mod_authz_host>
Require all denied
</IfModule>
<IfModule !mod_authz_host>
Order allow,deny
Deny from all
</IfModule>
</Files>

## Don't allow access to git directories
<IfModule alias_module>
RedirectMatch 404 /\.git
</IfModule>

## Uncomment these rules if you want to have nice URLs using
## $conf['userewrite'] = 1 - not needed for rewrite mode 2
RewriteEngine on

RewriteRule ^_media/(.*) lib/exe/fetch.php?media=$1 [QSA,L]
RewriteRule ^_detail/(.*) lib/exe/detail.php?media=$1 [QSA,L]
RewriteRule ^_export/([^/]+)/(.*) doku.php?do=export_$1&id=$2 [QSA,L]
RewriteRule ^$ doku.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) doku.php?id=$1 [QSA,L]
RewriteRule ^index.php$ doku.php

## Not all installations will require the following line. If you do,
## change "/dokuwiki" to the path to your dokuwiki directory relative
## to your document root.
#RewriteBase /dokuwiki

## If you enable DokuWikis XML-RPC interface, you should consider to
## restrict access to it over HTTPS only! Uncomment the following two
## rules if your server setup allows HTTPS.
#RewriteCond %{HTTPS} !=on
#RewriteRule ^lib/exe/xmlrpc.php$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R=301]
Copy path View file
@@ -189,6 +189,31 @@ Available variables:
- `DOKUWIKI_EMAIL`: Dokuwiki application email. Default: **user@example.com**
- `DOKUWIKI_WIKI_NAME`: Dokuwiki wiki name. Default: **Bitnami DokuWiki**

## Nice Url Rewriting

To enable [url rewriting](https://www.dokuwiki.org/rewrite), modify the AllowOverride directive at `/bitnami/apache/conf/vhosts/dokuwiki-vhost.conf`:

```
AddType application/x-httpd-php .php
<VirtualHost 127.0.0.1:80 _default_:80>
ServerAlias *
DocumentRoot /opt/bitnami/dokuwiki
<Directory "/opt/bitnami/dokuwiki">
Options -Indexes +FollowSymLinks -MultiViews
AllowOverride All
Require all granted
DirectoryIndex index.html index.php
</Directory>
Include /opt/bitnami/apache/conf/vhosts/htaccess/dokuwiki-htaccess.conf
</VirtualHost>
```

Then enable the url rewriting option in the configuration manager as [documented on the wiki](https://www.dokuwiki.org/rewrite).

# Notable Changes

## 0.20170219.201708232029-r3
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.