The Moz Q&A Forum

    • Forum
    • Questions
    • My Q&A
    • Users
    • Ask the Community

    Welcome to the Q&A Forum

    Browse the forum for helpful insights and fresh discussions about all things SEO.

    1. SEO and Digital Marketing Q&A Forum
    2. Categories
    3. On-Page / Site Optimization
    4. Redirect both / and non-/ URLs?

    Redirect both / and non-/ URLs?

    On-Page / Site Optimization
    5 3 161
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as question
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • OVJ
      OVJ last edited by

      I am doing SEO on WP site. Due to some duplicate pages (rel canonical was done before) I am doing 301 redirects at the moment. And I wonder if I need to redirect both links w/ and w/o trailing slash. Default is non www, w/o trailing slash.

      Like there is .com/category/news but there is same page linked in .com/news (well it works when permalink structure is set to /%category%/%postname% and returns 404 error when structure is set to /%postname%). 
      I redirected .lt/naujienos to .lt/category/naujienos. Should I also redirect .lt/naujienos/ (with trailing slash)?

      There's absolutely no problem redirecting this, but there are some more pages which I want to edit their URLs and I wonder If I should do both redirects from links /w and w/o slash?

      1 Reply Last reply Reply Quote 1
      • Chris.Menke
        Chris.Menke last edited by

        Fisher,

        Google deals with both with / and without / as though they are the same thing so I wouldn't worry about redirecting those.  If visitors normally get a trailing slash, canonicalize that, if they don't canonicalize on the URL without the slash.

        http://www.mattcutts.com/blog/seo-advice-url-canonicalization/

        1 Reply Last reply Reply Quote 1
        • Sturge
          Sturge last edited by

          Another option would be to add another re-direct rule that would add a trailing slash to all of the URLS.
          So effectively, if you re-direct the non-trailing URLS all URLS would then have a trailing slash.

          RewriteCond %{REQUEST_URI} !.[^./]+$
          RewriteCond %{REQUEST_URI} !(.)/$
          RewriteRule ^(.
          )$ /$1/ [R=301,L]

          Give this a try maybe? Just ensure that the REL Canonical reflects the URLS WITH the trailing slash otherwise you will get stuck in a canonical loop.

          Craig Curchin
          Twitter: @craigcurchin

          OVJ 1 Reply Last reply Reply Quote 1
          • OVJ
            OVJ @Sturge last edited by

            Well, I want non-trailing URLs as they are at the moment. They should be (the ones without trailing slash) rel canonical as they were before I changed permalink structure ( it was set to default: /?p=123) to /%postname%

            I guess I will wait a crawl to see how it is at the moment and fix all those pages with 404.

            BTW, google shows my site and pages with /. Maybe it hasn't recrawled yet.

            1 Reply Last reply Reply Quote 0
            • OVJ
              OVJ last edited by

              There is my .htaccess at the moment:

              <ifmodule mod_rewrite.c="">RewriteEngine On
              RewriteBase /
              RewriteRule ^index.php$ - [L]
              RewriteCond %{REQUEST_FILENAME} !-f
              RewriteCond %{REQUEST_FILENAME} !-d
              RewriteRule . /index.php [L]</ifmodule>

              I don't want to mess with it because I don't have an access to cpanel.

              1 Reply Last reply Reply Quote 0
              • 1 / 1
              • First post
                Last post
              • Is it better to shorten my existing url to use only keyword after domain with a 301 redirect from existing url
                mrkingsley
                mrkingsley
                2
                12
                96

              • Hi - How do you get rid of duplicate content that was accidentally created on a tag url? For example, when I published a new article, the content was duplicated on: /posts/tag/lead-generation/
                MikeRoberts
                MikeRoberts
                0
                4
                82

              • SERP Hijacking/Content Theft/ 302 Redirect?
                SneakerFiles
                SneakerFiles
                0
                4
                577

              • Htaccess redirect, from /year/month to /blog
                sergeystefoglo
                sergeystefoglo
                0
                3
                338

              • My home page URL http://seadwellers.com/ redirects to http://www.seadwellers.com/. Is this a problem?
                TheeDigital
                TheeDigital
                0
                3
                100

              • Redirecting web site URL to http://torontoairportlimoflatrate.com/ to http://www.torontoairportlimoflatrate.com
                My-Favourite-Holiday-Cottages
                My-Favourite-Holiday-Cottages
                0
                2
                419

              • How do I do a 301 Redirect in IIS 7 from http://www.freightmonster.com/index.html to http://freightmonster.com/index.html when I don't have a physical page to redirect?
                EricaMcGillivray
                EricaMcGillivray
                0
                4
                1.0k

              • URL http://www.1step2heaven.co.uk.
                DanSpeicher
                DanSpeicher
                0
                7
                774

              Get started with Moz Pro!

              Unlock the power of advanced SEO tools and data-driven insights.

              Start my free trial
              Products
              • Moz Pro
              • Moz Local
              • Moz API
              • Moz Data
              • STAT
              • Product Updates
              Moz Solutions
              • SMB Solutions
              • Agency Solutions
              • Enterprise Solutions
              • Digital Marketers
              Free SEO Tools
              • Domain Authority Checker
              • Link Explorer
              • Keyword Explorer
              • Competitive Research
              • Brand Authority Checker
              • Local Citation Checker
              • MozBar Extension
              • MozCast
              Resources
              • Blog
              • SEO Learning Center
              • Help Hub
              • Beginner's Guide to SEO
              • How-to Guides
              • Moz Academy
              • API Docs
              About Moz
              • About
              • Team
              • Careers
              • Contact
              Why Moz
              • Case Studies
              • Testimonials
              Get Involved
              • Become an Affiliate
              • MozCon
              • Webinars
              • Practical Marketer Series
              • MozPod
              Connect with us

              Contact the Help team

              Join our newsletter
              Moz logo
              © 2021 - 2026 SEOMoz, Inc., a Ziff Davis company. All rights reserved. Moz is a registered trademark of SEOMoz, Inc.
              • Accessibility
              • Terms of Use
              • Privacy