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. Technical SEO Issues
    4. .htaccess help please

    .htaccess help please

    Technical SEO Issues
    3 3 461
    • 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.
    • theshortstack
      theshortstack last edited by

      Hi there,

      Can anyone let me know what I need to add to my .htaccess file to make sure that the trailing slash on my domain gets redirected to my main domain name.

      For example, at the moment Google is seeing my primary domain as follows:

      http://www.mydomain.com

      http://www.mydomain.com/

      I thought I'd covered off all possible duplication penalities but it look as though I've still got one left!

      Thanks very much for your help,

      Simon

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

        I think this will remove

        RewriteCond %{HTTP_HOST} ^(www.)?domain.com$ [NC]
        RewriteRule ^(.+)/$ http://www.domain.com/$1 [R=301,L]

        1 Reply Last reply Reply Quote 2
        • Dr-Pete
          Dr-Pete last edited by

          If it's just the home-page, it might be easier safer to put a canonical tag on it. A canonical on the home-page can help sweep up weird variants (which are coming). If you got the htaccess route, just test it thoroughly. It can be really tough to write rewrites for other people's sites (without knowing specifics or testing). That said, I think @webfeatseo is on the right track.

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            Last post
          • Where i am making mistake ? please help
            cepprolimehost
            cepprolimehost
            1
            7
            207

          • Need help please with url guidelines.
            signsny
            signsny
            0
            6
            105

          • Rel Canonical ? please help again!
            ske11
            ske11
            0
            2
            242

          • Problem with Duplication. Please help
            Abhi123
            Abhi123
            0
            5
            182

          • Please help me critique my friends site
            bradkrussell
            bradkrussell
            0
            3
            550

          • Buddy Press Nightmare Please Help
            deltasystems
            deltasystems
            0
            2
            472

          • Help with domain redirect advice please!
            RyanKent
            RyanKent
            0
            14
            1.3k

          • How to use Author tag - Please help
            blu42media
            blu42media
            0
            20
            2.4k

          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