Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WordPress Trailing Slash

WordPress adds trailing slash to each url as per permalink settings.

/%postname%/

So if you browse www.mysite.com/about-us you will be redirected to www.mysite.com/about-us/

Is it possible to disable this redirect so that the page is served with and without the trailing slash.

like image 989
user812120 Avatar asked Jan 19 '26 04:01

user812120


1 Answers

change permalink /%postname%/ to /%postname%

enter image description here

Right below the RewriteEngine On line, add:

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

Moreinfo htaccess code

like image 123
Ravi Patel Avatar answered Jan 22 '26 01:01

Ravi Patel