I have a WordPress in the directory www.example.com/blog/
and it works fine. All the URLs ended in '/' (www.example.com/blog/article/
), but I have corrected it from Settings/Permalinks (www.example.com/blog/article
). There is only one URL that I can't manage to remove the final '/', www.example.com/blog/
, I need it to be www.example.com/blog
.
When I save in Settings/Permalinks WordPress modifies the .htaccess
to:
# BEGIN All In One WP Security
#AIOWPS_BLOCK_SPAMBOTS_START
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_METHOD} POST
RewriteCond %{REQUEST_URI} ^(.*)?wp-comments-post\.php(.*)$
RewriteCond %{HTTP_REFERER} !^http(s)?://(.*)?\.example\.com/blog [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^$
RewriteRule .* http://127.0.0.1 [L]
</IfModule>
#AIOWPS_BLOCK_SPAMBOTS_END
# END All In One WP Security
# BEGIN WordPress
# Las directivas (líneas) entre «BEGIN WordPress» y «END WordPress» son
# generadas dinámicamente y solo deberían ser modificadas mediante filtros de WordPress.
# Cualquier cambio en las directivas que hay entre esos marcadores serán sobrescritas.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /blog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>
# END WordPress
I've changed RewriteBase /blog/
to RewriteBase /blog, but it's not the solution. I don't understand why WordPress generates the RewriteBase with /blog/
directly and not with /blog, because the site and WordPress address in Settings/General is www.example.com/blog
.
Inspecting from Google Chrome I see that there is a 301 redirect from www.example.com/blog
to www.example.com/blog/
, but I think it is done by WordPress itself.