Score:0

Redirect removing slash after domain

pw flag

In moving to https URLs for my self-hosted site, I added a redirect to the .htaccess file:

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]

This redirects to http to https for all pages, except for my blog. The blog is a WordPress installation in a subdirectory called bestpractices. When I click on any link leading to a blog page, the slash is removed from after the domain, so http://www.example.com/bestpractices becomes https://www.example.combestpractices.

The WordPress subfolder has its own .htaccess file with the standard WP auto-generated text:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /bestpractices/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /bestpractices/index.php [L]
</IfModule>

Perhaps the issue is caused by this, since the problem occurs only with WordPress pages. I don't know enough about rewrites to tell.

I thought I found an answer here, since the question seems to match my setup: Trying to redirect with and without trailing slash, but the top answer does not solve the problem. I still get the same result.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.