I am using Wordpress for a "news" section on a e-commerce site. So the root of the wordpress install is in a sub-folder.


I have setup the home & site URL to reflect this in the admin. I also make sure there are no trailing slashes in the permalinks. However, it keeps doing a 301 redirect and forcing a trailing slash so it looks like:


I even tried to force it in the wp-config.php file, defining the WP_HOME and WP_SITEURL parameters. I cannot for the life of me figure out where this is happening. I don't mind creating a small PHP function to rewrite this url (without any kind of redirect).


  • 2
    your server does this.
    – Milo
    Feb 10, 2014 at 20:08
  • We are using nginx. Lemme see if I can find a directive in there.
    – Nathan
    Feb 10, 2014 at 20:38
  • So far, it looks like that trailing slash can only be removed doing a redirect.
    – Nathan
    Feb 10, 2014 at 20:55
  • Check out Settings > Permalinks and make sure there is no trailing slash on the option chosen. You may have to choose the custom structure option and then copy the structure you want, without the trailing slash of course.
    – kel
    Mar 11, 2015 at 19:32

1 Answer 1


add this line to functions.php

remove_filter('template_redirect', 'redirect_canonical');

and don't forget clear cache or test on clean browser

  • 1
    Please add an explanation to your answer: why could that solve the problem? Are there any side-effects?
    – fuxia
    Apr 13, 2015 at 14:16
  • This this line you can fix redirect from domain.com/page to domain.com/page/ with trail slash
    – Nerjuz
    Apr 14, 2015 at 7:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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