Sites with url end in .html
-
Hi everyone,
I am using the Staatic plugin to host an old blog that I have. Everything works fine, but my blog permalinks end with .html because I migrated it from Blogger to WordPress a few years ago.
Due to the .html permalinks, the statically generated files follow the schema /year/month/blog-post.html/index.html. So when I publish my site, the URL adds a “/” at the end, making my static page URL look like this: /year/month/blog-post.html/. I’m unsure if this causes any problems with SEO. Can you please fix this?
Best regards,
Edson Luiz Candido
-
I created a simple c# program to fix this, I don’t know if this help but follow the code
https://github.com/edsonlcandido/RenomearPastasStaatic/blob/master/Program.csHello Edson,
Thank you for reaching out and for providing a detailed explanation of the issue you’re encountering with your blog’s permalinks. We understand your concern regarding the URL structure and its potential impact on SEO.
Staatic is designed to adapt to the permalink structure you’ve configured within your WordPress settings. If your permalinks are set to include “.html” at the end, like “/%postname%.html”, Staatic should normally generate links that exactly match this structure, resulting in URLs like “/some/page.html”. The presence of “/some/page.html/index.html” on the filesystem is due to how Staatic organizes content for web delivery. This technical detail is primarily for serving the files correctly and should not affect how your URLs appear to visitors or search engines.
However, the issue you’re experiencing, where a trailing slash is added to your URLs, making them appear as “/year/month/blog-post.html/”, is something we can certainly look into. This behavior isn’t expected based on the permalink structure you’ve described.
To help us diagnose and address this issue more effectively, could you please provide us with your site’s Health screen information? This can be found by going to Tools > Site Health > Info (tab) in your WordPress dashboard. There, you’ll find a button to copy the information to your clipboard. Once you have that information, please send it to us at [email protected].
Additionally, we appreciate you sharing the C# program you created to address this issue.
Thanks in advance for providing the requested information.
Hi everyone,
Follow infos about my WP installation
` wp-core version: 6.4.3 site_language: pt_BR user_language: pt_BR timezone: America/Sao_Paulo permalink: /%year%/%monthnum%/%postname%.html https_status: false multisite: false user_registration: 0 blog_public: 1 default_comment_status: undefined environment_type: production user_count: 1 dotorg_communication: true wp-paths-sizes wordpress_path: /var/www/html wordpress_size: 531,08 MB (556880334 bytes) uploads_path: /var/www/html/wp-content/uploads uploads_size: 870,10 MB (912368078 bytes) themes_path: /var/www/html/wp-content/themes themes_size: 22,85 MB (23961650 bytes) plugins_path: /var/www/html/wp-content/plugins plugins_size: 35,41 MB (37125167 bytes) database_size: 36,65 MB (38426624 bytes) total_size: 1,46 GB (1568761853 bytes) wp-active-theme name: Edson Zuando Tudo (edsonzuandotudo) version: 1.1 author: Edson Zuando Tudo author_website: https://www.edsonzuandotudo.info/ parent_theme: none theme_features: core-block-patterns, title-tag, menus, widgets-block-editor, widgets theme_path: /var/www/html/wp-content/themes/edsonzuandotudo auto_update: Desativado wp-themes-inactive (6) Twenty Fifteen: version: 3.6, author: a equipe do WordPress, Atualiza??es automáticas desativadas Twenty Fourteen: version: 3.8, author: a equipe do WordPress, Atualiza??es automáticas desativadas Twenty Thirteen: version: 4.0, author: a equipe do WordPress, Atualiza??es automáticas desativadas Twenty Twenty-Four: version: 1.0, author: the WordPress team, Atualiza??es automáticas desativadas Twenty Twenty-Three: version: 1.3, author: a equipe do WordPress, Atualiza??es automáticas desativadas Twenty Twenty-Two: version: 1.6, author: the WordPress team, Atualiza??es automáticas desativadas wp-plugins-active (7) Akismet Anti-spam: Spam Protection: version: 5.3.1, author: Automattic - Anti-spam Team, Atualiza??es automáticas desativadas Backup Migration: version: 1.4.3, author: Inisev, Atualiza??es automáticas desativadas Broken Link Checker: version: 2.2.4, author: WPMU DEV, Atualiza??es automáticas desativadas Simply Static: version: 3.1.6.1, author: Patrick Posner, Atualiza??es automáticas desativadas Staatic - Static Site Generator: version: 1.9.2, author: Team Staatic, Atualiza??es automáticas desativadas WPCode Lite: version: 2.1.9, author: WPCode, Atualiza??es automáticas desativadas Yoast SEO: version: 22.1, author: Team Yoast, Atualiza??es automáticas desativadas wp-plugins-inactive (2) Hello Dolly: version: 1.7.2, author: Matt Mullenweg, Atualiza??es automáticas desativadas WP Hide Post: version: 1.2.2, author: scriptburn.com, Atualiza??es automáticas desativadas wp-media image_editor: WP_Image_Editor_Imagick imagick_module_version: 1691 imagemagick_version: ImageMagick 6.9.11-60 Q16 x86_64 2021-01-25 https://imagemagick.org imagick_version: 3.6.0 file_uploads: 1 post_max_size: 8M upload_max_filesize: 2M max_effective_size: 2 MB max_file_uploads: 20 imagick_limits: imagick::RESOURCETYPE_AREA: 122 MB imagick::RESOURCETYPE_DISK: 1073741824 imagick::RESOURCETYPE_FILE: 786432 imagick::RESOURCETYPE_MAP: 512 MB imagick::RESOURCETYPE_MEMORY: 256 MB imagick::RESOURCETYPE_THREAD: 1 imagick::RESOURCETYPE_TIME: 9.2233720368548E+18 imagemagick_file_formats: 3FR, 3G2, 3GP, AAI, AI, APNG, ART, ARW, AVI, AVIF, AVS, BGR, BGRA, BGRO, BIE, BMP, BMP2, BMP3, BRF, CAL, CALS, CANVAS, CAPTION, CIN, CIP, CLIP, CMYK, CMYKA, CR2, CR3, CRW, CUR, CUT, DATA, DCM, DCR, DCX, DDS, DFONT, DNG, DPX, DXT1, DXT5, EPDF, EPI, EPS, EPS2, EPS3, EPSF, EPSI, EPT, EPT2, EPT3, ERF, FAX, FILE, FITS, FRACTAL, FTP, FTS, G3, G4, GIF, GIF87, GRADIENT, GRAY, GRAYA, GROUP4, H, HALD, HDR, HEIC, HISTOGRAM, HRZ, HTM, HTML, HTTP, HTTPS, ICB, ICO, ICON, IIQ, INFO, INLINE, IPL, ISOBRL, ISOBRL6, J2C, J2K, JBG, JBIG, JNG, JNX, JP2, JPC, JPE, JPEG, JPG, JPM, JPS, JPT, JSON, K25, KDC, LABEL, M2V, M4V, MAC, MAGICK, MAP, MASK, MAT, MATTE, MEF, MIFF, MKV, MNG, MONO, MOV, MP4, MPC, MPG, MRW, MSL, MTV, MVG, NEF, NRW, NULL, ORF, OTB, OTF, PAL, PALM, PAM, PATTERN, PBM, PCD, PCDS, PCL, PCT, PCX, PDB, PDF, PDFA, PEF, PES, PFA, PFB, PFM, PGM, PGX, PICON, PICT, PIX, PJPEG, PLASMA, PNG, PNG00, PNG24, PNG32, PNG48, PNG64, PNG8, PNM, POCKETMOD, PPM, PREVIEW, PS, PS2, PS3, PSB, PSD, PTIF, PWP, RADIAL-GRADIENT, RAF, RAS, RAW, RGB, RGBA, RGBO, RGF, RLA, RLE, RMF, RW2, SCR, SCT, SFW, SGI, SHTML, SIX, SIXEL, SPARSE-COLOR, SR2, SRF, STEGANO, SUN, TEXT, TGA, THUMBNAIL, TIFF, TIFF64, TILE, TIM, TTC, TTF, TXT, UBRL, UBRL6, UIL, UYVY, VDA, VICAR, VID, VIDEO, VIFF, VIPS, VST, WBMP, WEBM, WEBP, WMV, WPG, X, X3F, XBM, XC, XCF, XPM, XPS, XV, XWD, YCbCr, YCbCrA, YUV gd_version: bundled (2.1.0 compatible) gd_formats: GIF, JPEG, PNG, WebP, BMP ghostscript_version: 10.00.0 wp-server server_architecture: Linux 5.15.133.1-microsoft-standard-WSL2 x86_64 httpd_software: Apache/2.4.57 (Debian) php_version: 8.1.27 64bit php_sapi: apache2handler max_input_variables: 1000 time_limit: 30 memory_limit: 128M admin_memory_limit: 256M max_input_time: -1 upload_max_filesize: 2M php_post_max_size: 8M curl_version: 7.88.1 OpenSSL/3.0.11 suhosin: false imagick_availability: true pretty_permalinks: true htaccess_extra_rules: true current: 2024-03-01T21:00:51+00:00 utc-time: Friday, 01-Mar-24 21:00:51 UTC server-time: 2024-03-01T18:00:48-03:00 wp-database extension: mysqli server_version: 5.7.43 client_version: mysqlnd 8.1.27 max_allowed_packet: 4194304 max_connections: 151 wp-constants WP_HOME: undefined WP_SITEURL: undefined WP_CONTENT_DIR: /var/www/html/wp-content WP_PLUGIN_DIR: /var/www/html/wp-content/plugins WP_MEMORY_LIMIT: 40M WP_MAX_MEMORY_LIMIT: 256M WP_DEBUG: false WP_DEBUG_DISPLAY: true WP_DEBUG_LOG: false SCRIPT_DEBUG: false WP_CACHE: false CONCATENATE_SCRIPTS: undefined COMPRESS_SCRIPTS: undefined COMPRESS_CSS: undefined WP_ENVIRONMENT_TYPE: Indefinido WP_DEVELOPMENT_MODE: undefined DB_CHARSET: utf8 DB_COLLATE: undefined wp-filesystem wordpress: writable wp-content: writable uploads: writable plugins: writable themes: writable staatic version: 1.9.2 site_url: https://www.edsonzuandotudo.info/ wordpress_url: https://www.edsonzuandotudo.info destination_url: / deployment_method: Filesystem process_not_found: Disabled lowercase_urls: Disabled http_auth_username: Undefined http_concurrency: 4 http_https_to_http: Undefined http_timeout: 60 ssl_verify_behavior: enabled ssl_verify_path: Undefined html_dom_parser: PHP DOM Wrapper publication_task_timeout: 180 test_request_status: 1709326721_1709326847
I run WP via docker container using portainer to create the stack, follow my docker-compose
version: '3.1' services: wp354-db: image: mysql:5.7 mem_limit: 512m mem_reservation: 128m volumes: - wp354-database:/var/lib/mysql restart: always environment: MYSQL_DATABASE: ${DATABASE} MYSQL_USER: ${USER} MYSQL_PASSWORD: ${PASSWORD} MYSQL_RANDOM_ROOT_PASSWORD: '1' networks: wp354-network: wp354: depends_on: - wp354-db image: wordpress:6.4.3-php8.1 mem_limit: 512m mem_reservation: 128m restart: always environment: WORDPRESS_DB_HOST: ${DATABASE}-db WORDPRESS_DB_USER: ${USER} WORDPRESS_DB_PASSWORD: ${PASSWORD} WORDPRESS_DB_NAME: ${DATABASE} networks: cdz-proxy: wp354-network: volumes: - wp354-html:/var/www/html networks: cdz-proxy: external: true wp354-network: volumes: wp354-database: wp354-html:
Thanks for the follow-up and the details about your setup. It helps us narrow down the issue with your permalink structure after using Staatic.
To ensure we’re on the same page, it sounds like the HTML Staatic generates has the correct links ending in “.html”, and your C# script only adjusts the static file/directory structure post-generation. This makes me wonder exactly where the “.html/” issue crops up in your workflow.
A few more questions for clarification:
- When and where exactly do you notice the URLs ending with “.html/”?
- You mentioned using Docker, but could you specify the web server(s) or proxy(s) setup? The server configuration might influence how URLs are handled and displayed.
Understanding these details is crucial for us to pinpoint the issue accurately.
Looking forward to your response.
Hi all,
Follow answers for your questions.
To ensure we’re on the same page, it sounds like the HTML Staatic generates has the correct links ending in “.html”
yes, the links correctly reference the appropriate URLs.C# script only adjusts the static file/directory structure post-generation
My script renames the index.html file to the folder name and moves it up one directoryWhen and where exactly do you notice the URLs ending with “.html/”?
I notice this when I publish static folder in a nginx docker enviroment, upon cliking a link with the correct URL, I observe a trailing “/” at the end of the URL, this occurs because the folder structure follows a format where the folder name corresponds to %postname%/index.htmlYou mentioned using Docker, but could you specify the web server(s) or proxy(s) setup?
I am using Nginx-Proxy-Manager, with the proxy host pointing to the container name. The setup is straightforward and not customizedBest Regards,
Thanks for clarifying the details. We now understand the issue stems from how Nginx handles your site’s file structure.
Nginx has a feature that automatically redirects requests to directories missing a trailing slash. This appears incompatible with Staatic’s default file structure, resulting in URLs with an unwanted trailing “/”.
There are a couple options to address this:
- Configure Nginx by changing the
try_files
declaration to:try_files $uri $uri/index.html $uri/ /index.html;
This should serve the correct page immediately instead of redirecting. However, we realize this may not be possible in all setups. - Use Staatic’s development version with an updated file structure. We’ve made changes so the file structure works with Nginx out of the box. You can download this version by:
- Going to the Staatic plugin page
- Selecting “Advanced View”
- Under “Advanced Options > Previous Versions”, choose “Development Version”
- Click “Download”
The development version should resolve the issue with unwanted slashes in your URLs. Please install this updated version of Staatic and let us know if you have any other questions or run into any issues.
Hi all,
I have downloaded the developer version. The version signature is the same as the actual 1.9.2. Is this correct?
In this version, all files were generated with a %postname%.html naming convention, and I am serving the files with nginx. Everything is working fine. Thank you very much for the quick support.
Best regards,
Edson Luiz CandidoYou’re correct – the version signature for the development build is currently the same as the stable 1.9.2 release. This signature will be updated with the next major stable version.
I’m really glad to hear that the adjusted file naming convention in the development version has resolved your issue with the unwanted trailing slashes! And that serving the static files through Nginx is now working smoothly.
Thank you for confirming that everything is operating as intended. We appreciate you taking the time to test the development build and provide feedback. Do not hesitate to reach out if any other questions come up.
- The topic ‘Sites with url end in .html’ is closed to new replies.