Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
  • How to redirect url from / slash to without slash / : 301 Redirect

    • 25/25
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 1.24k
    Comment on it

    Url with and without / (slash)

    Url ending with" slash and without " / " slash for example and

    Now the question is does Google take and treats both the urls as a separate pages.

    The answer is yes, Google treats both the url as separate identity, the issue will occurs as both url renders the same content and if you do not fix this issue your site will be penalized by search engine , i.e Google. Such issues are known as canonical issues so to solve such issue you have to use canonical urls or we call ot 301 redirect, doing this it will make sure that search engines will understand that these pages are the same and which URL to use in their search results. It also makes sure all links to the canonical URL are credited to the main URL.


    For example:

    For doing a 301 redirect in application using .htaccess to map URLs just follow below URL structure in my .htaccess file

    # remove trailing slash
    RewriteRule ^(.*)/$ /$1 [L,R=301]


    # add trailing slash
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^.*[^/]$ /$0/ [L,R=301]

    Now put canonical <link> tag in your web page. It doesn't involve htaccess at all

    Keep your htaccess file as it is shown above. Then on put the canonical <link> tag for or vice-versa.

    For more read Google article here:


    More on canonical url and issue please visit my previous blog:

    How to Resolve Canonical Issue? (301 redirect)

 0 Comment(s)

Sign In

Sign up using

Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: