1 year ago
#381607
Paul Littlefield
Yoast XML Sitemaps and Docker WordPress not working
I am using the official WordPress image with Apache and can confirm that the htaccess file in the container is being used because I can cause an Server Errror with incorrect code.
All seems well apart from the Yoast SEO plugin - the XML sitemap just will not show up as expected.
I have read this official help page and checked it all...
https://yoast.com/help/xml-sitemaps-apache/
...but it does not work for me.
Here is an extract of the Docker Compose file which shows the volume mount...
domain.co.uk-wordpress:
depends_on:
- domain.co.uk-wordpress_db
image: wordpress:latest
container_name: domain.co.uk-wordpress
restart: always
networks:
nginx-proxy-manager:
ipv4_address: 172.20.0.30
volumes:
- ./data/html:/var/www/html
Here is the content of the .htaccess file...
# Yoast SEO - XML Sitemap Rewrite Fix
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^sitemap_index.xml$ /index.php?sitemap=1 [L]
RewriteRule ^locations.kml$ /index.php?sitemap=wpseo_local_kml [L]
RewriteRule ^geo_sitemap.xml$ /index.php?sitemap=geo [L]
RewriteRule ^([^/]+?)-sitemap([0-9]+)?.xml$ /index.php?sitemap=$1&sitemap_n=$2 [L]
RewriteRule ^([a-z]+)?-?sitemap.xsl$ /index.php?yoast-sitemap-xsl=$1 [L]
</IfModule>
# END Yoast SEO - XML Sitemap Rewrite Fix
# BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
...but the SEO Sitemap part is ignored.
Can anyone help to get this working or is this a known limitation of Docker WordPress?
Thanks!
Paully
wordpress
docker
sitemap
0 Answers
Your Answer