Remove site root trailing slash

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.

www.mysite.com/news

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:

www.mysite.com/news/

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).

Ideas?

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

Leave a Comment