mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +08:00
Simplify ddev .htaccess handling
This commit is contained in:
parent
29aff60d27
commit
b84177b61c
3 changed files with 17 additions and 21 deletions
|
@ -14,21 +14,6 @@ if [ "${WP_MULTISITE}" = "true" ]; then
|
||||||
--admin_email="${ADMIN_EMAIL}" \
|
--admin_email="${ADMIN_EMAIL}" \
|
||||||
--skip-email
|
--skip-email
|
||||||
|
|
||||||
cat << 'EOF' >> ".htaccess"
|
|
||||||
RewriteEngine On
|
|
||||||
RewriteBase /
|
|
||||||
RewriteRule ^index\.php$ - [L]
|
|
||||||
|
|
||||||
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
|
|
||||||
|
|
||||||
RewriteCond %{REQUEST_FILENAME} -f [OR]
|
|
||||||
RewriteCond %{REQUEST_FILENAME} -d
|
|
||||||
RewriteRule ^ - [L]
|
|
||||||
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
|
|
||||||
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
|
|
||||||
RewriteRule . index.php [L]
|
|
||||||
EOF
|
|
||||||
|
|
||||||
readarray -d , -t slugs <<< "${WP_MULTISITE_SLUGS},"; unset "slugs[-1]";
|
readarray -d , -t slugs <<< "${WP_MULTISITE_SLUGS},"; unset "slugs[-1]";
|
||||||
for slug in "${slugs[@]}"; do
|
for slug in "${slugs[@]}"; do
|
||||||
if [ ! -z "${slug}" ]; then
|
if [ ! -z "${slug}" ]; then
|
||||||
|
|
16
.ddev/commands/web/orchestrate.d/11_htaccess.sh
Normal file
16
.ddev/commands/web/orchestrate.d/11_htaccess.sh
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
cat << 'EOF' >> ".htaccess"
|
||||||
|
RewriteEngine On
|
||||||
|
RewriteBase /
|
||||||
|
RewriteRule ^index\.php$ - [L]
|
||||||
|
|
||||||
|
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
|
||||||
|
|
||||||
|
RewriteCond %{REQUEST_FILENAME} -f [OR]
|
||||||
|
RewriteCond %{REQUEST_FILENAME} -d
|
||||||
|
RewriteRule ^ - [L]
|
||||||
|
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
|
||||||
|
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
|
||||||
|
RewriteRule . index.php [L]
|
||||||
|
EOF
|
|
@ -1,9 +1,4 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Needed for generating the .htaccess file
|
|
||||||
echo "apache_modules:
|
|
||||||
- mod_rewrite
|
|
||||||
" > wp-cli.yml
|
|
||||||
|
|
||||||
wp rewrite structure '/%postname%'
|
wp rewrite structure '/%postname%'
|
||||||
wp rewrite flush --hard
|
wp rewrite flush
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue