Skip to content

Instantly share code, notes, and snippets.

@rojenzaman
Created July 25, 2020 15:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rojenzaman/95c2896299ef9a48f420a3b8e8bbc5a5 to your computer and use it in GitHub Desktop.
Save rojenzaman/95c2896299ef9a48f420a3b8e8bbc5a5 to your computer and use it in GitHub Desktop.
Set .htaccess file on bitnami dokuwiki (FOR PODMAN, NOT DOCKER)
#!/bin/bash
echo "ONLY FOR PODMAN"
conf_file=$(find ~/.local/share/containers/storage -name dokuwiki-htaccess.conf 2>/dev/null)
podman exec dokuwiki cat /opt/bitnami/dokuwiki/.htaccess.dist > /tmp/.htaccess
cat >> /tmp/.htaccess << EOF
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
EOF
chmod 644 /tmp/.htaccess
podman cp /tmp/.htaccess dokuwiki:/opt/bitnami/dokuwiki/ && echo ".htaccess file created."
if grep -Fxq "/opt/bitnami/dokuwiki/.htaccess" "$conf_file"
then
echo "found"
else
echo "not found"
echo "for add conf to file press enter"
read
cat >> $conf_file << EOF
<Directory "/opt/bitnami/dokuwiki">
/opt/bitnami/dokuwiki/.htaccess
</Directory>
EOF
echo "added."
fi
@rojenzaman
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment