• Skip to primary navigation
  • Skip to content
  • Skip to primary sidebar

A cPanel Tech

The Diaries of a Linux Server Administrator

  • Home
  • About
  • Privacy
You are here: Home / Nginx / Add a training slash for nginx websites

Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /home/cptech/public_html/wp-content/themes/genesis/lib/functions/image.php on line 116

Add a training slash for nginx websites

November 28, 2015 By admin Leave a Comment

In Nginx web servers, most of us might have came across a situation where our sub folder access wont work some times and if we add a trailing slash , it start to work
ie
http://domain.com/sub-folder  wont work
when http://domain.com/sub-folder/  works.

Fix add a redirect rule to auto insert the trailing slash – here is the code for that

rewrite ^/([^.]*[^/])$ $1/ permanent;

Filed Under: Nginx

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Copyright 2018 CPanelTech