Remove Trailing Slash from WordPress URL (The site also don't have www)

Posted by mrintech on Server Fault See other posts from Server Fault or by mrintech
Published on 2012-03-20T09:00:01Z Indexed on 2012/03/20 11:32 UTC
Read the original article Hit count: 213

Filed under:
|
|

I need help as I am confused a lot with .htaccess

Some months back, I removed WWW from the URL of my domain name using following .htaccess lines:

RewriteCond %{HTTP_HOST} !^example.com$ [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]

Now, I also want to remove the trailing slash from the URL, as because I am using WordPress and a page/post will open, no matter if there's a trailing slash or NOT!

I request you to please provide me the .htaccess code, so that I can REMOVE the trailing slash. Kindly remember, I don't want WWW also and I have already set .htaccess rule for the removal of WWW

Note: 3 Years back when I started the blog, I set the Permalinks Structure without trailing slash. Now, suddenly Google Webmasters Tools is showing warnings. Also, the URL for rel="canonical" is WITHOUT trailing slash

If you require any more details, I will be happy to provide

© Server Fault or respective owner

Related posts about .htaccess

Related posts about Wordpress