Sfoglia il codice sorgente

Set default permalink structure to post name

Girish Ramakrishnan 8 anni fa
parent
commit
9407e596ed
1 ha cambiato i file con 7 aggiunte e 2 eliminazioni
  1. 7 2
      start.sh

+ 7 - 2
start.sh

@@ -20,6 +20,9 @@ sed -e "s/##MYSQL_DATABASE/${MYSQL_DATABASE}/" \
     -e "s/##NONCE_SALT/$(pwgen -1cns 64)/" \
     /app/code/wp-config.php.template > /run/wordpress/wp-config.php # sed -i seems to destroy symlink
 
+# Used for wp rewrite
+touch /app/data/htaccess
+
 if [[ ! -f "/app/data/.dbsetup" ]]; then
     echo "Copying wp-content files on first run"
     mkdir -p /app/data/wp-content/mu-plugins
@@ -38,6 +41,10 @@ if [[ ! -f "/app/data/.dbsetup" ]]; then
         --admin_email="${admin_email}"
     echo "WP is now installed"
 
+    # Set default post structure to what most people want
+    # Curiously, installing some plugins prevents .htaccess getting written
+    $WP rewrite structure '/%postname%/'
+
     touch "/app/data/.dbsetup"
 else
     # Update wordpress
@@ -110,8 +117,6 @@ EOF
 )
 $WP --format=json option update authLDAPOptions "${ldapConfig}"
 
-touch /app/data/htaccess
-
 chown -R www-data:www-data /app/data /run/wordpress
 
 echo "Starting apache"