My WordPress in installed in a folder, https://example.com/folder/. I would like WP index page to get accessed by https://example.com/folder, however, WP 301 redirects it to https://example.com/folder/.

What do I need to do to get no trailing slash and no redirects when accessing https://example.com/folder?

  • From my testing, it appears as though WordPress is doing the redirect but only on the home page if it's a folder. I've tried disabling all plugins, changing themes, adjusting the Permalink, and even adding DirectorySlash Off | RewriteOptions AllowNoSlash to the .htaccess. Nothing works. Have you found a solution? – Syclone Nov 1 '20 at 6:37
  • @Syclone no I didn't (( – CamSpy Nov 18 '20 at 13:27

In your .htaccess file you could try this below the RewriteEngine On line

RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R]

Taken from: https://stackoverflow.com/questions/21417263/htaccess-add-remove-trailing-slash-from-url

  • I've tried it before, doesn't work – CamSpy Aug 30 '19 at 13:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.