Remove Trailing Slash in WordPress

WordPress Administration is a versatile experience and it gives you some extra level flexibility to manage WordPress and consider the power of Open Source Content management system (CMS). I am going to remove trailing slash in WordPress with possible techniques. I am a lazy System Administrator and I always choose, the easy method to adopt but it’s up to your super genius’s nature that you adopt the easiest solution or go for the some extra efforts.
Suppose we have a WordPress URL like this: http://rizwanranjha.com/wordpress/ and we want to remove the trailing slash (aka - last slash) or / from the URL to make it more clean and to perfect your SEO efforts for your blog.

Remove Trailing Slash in WordPress

Removing Trailing slash in WordPress Dashboard, it is already quite easy and you simply need to do this
  1. Login on your WordPress Admin with your Administration Account.
  2. In Dashboard Section, Click on the Settings Menu.
  3. Click on Permalink under Settings Menu and this will take you the Permalink Settings page.
  4. Click on Custom Structure Radio Button and type /%postname%
  5. Click on Save Changes and Check with your Blog.

Remove Trailing Slash in WordPress using .htaccess

I am not the lover of tricky solutions but for the sake of knowledge and to entertain the expert level of users, I am including this solution as well.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteRule (.+)/$ http://rizwanranjha.com/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
For this, in some cases, need to create .htaccess file in the root path of your Wordpress Installation. This should work like a charm but you must make sure that you replaced rizwanranjha.com domain name with your own Domain Name.

No comments:

Post a Comment