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. Intermediate & Advanced SEO
    4. .htaccess question/opinion/advice needed

    .htaccess question/opinion/advice needed

    Intermediate & Advanced SEO
    1 1 150
    • 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.
    • Eblan
      Eblan last edited by

      Hello,

      I am trying to achieve 3 different things on my .htaccess I just want to make sure I am doing it the right or best way because I don't have much experience working on this kind of files.

      I am trying to:

      a) Redirect www.mysite.com/index.html to www.mysite.com so I don't get a duplicate content/tag error.

      b) Redirect mysite.com to www.mysite.com

      c) Get rid of the file extensions; www.mysite.com/stuff.html to www.mysite.com/stuff

      This is the code that I'm currently using and it seems to work fine, however I would like someone with experience to take a look so I can avoid internal server errors and other kinds of issues. I grabbed each piece of code from different posts and tutorials.

      Options +FollowSymlinks            
      RewriteEngine on

      Index Rewrite                                                                                                                 RewriteRule ^index.(htm|html|php) http://www.mysite.com/ [R=301,L]                 RewriteRule ^(.*)/index.(htm|html|php) http://www.mysite.com/$1/ [R=301,L]

      RewriteEngine on
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_FILENAME}.html -f
      RewriteRule ^(.*)$ $1.html

      Options +FollowSymlinks
      RewriteEngine on
      Rewritecond %{http_host} ^mysite.com [nc]
      Rewriterule ^(.*)$ http://www.mysite.com/$1 [r=301,nc]

      Thanks a lot!

      1 Reply Last reply Reply Quote 0
      • 1 / 1
      • First post
        Last post
      • Looking for opinions on structuring meta title tags/page title/menu title/H1
        ClaytonJ
        ClaytonJ
        1
        4
        185

      • Question about Indexing of /?limit=all
        RobAus
        RobAus
        0
        3
        146

      • Links Questions and advice?
        ClaytonJ
        ClaytonJ
        0
        3
        83

      • Domain Authority... http://www.domain.com/ vs. http://domain.com vs. http://domain.com/
        MattAntonino
        MattAntonino
        0
        4
        136

      • A/B Split Testing - Rankings Drop? Need an expert opinion...
        AMHC
        AMHC
        1
        3
        96

      • Quick htaccess question
        Modi
        Modi
        0
        3
        130

      • We will be switching our shopping cart platform from volusion to magento and really cautious / nervous about our rankings / seo stuff. any advice for anyone that has migrated stores, etc. these urls are years old, etc.
        danatanseo
        danatanseo
        0
        2
        233

      • Any advice for my website http://cvcsports.com?
        EGOL
        EGOL
        0
        6
        537

      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