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 code ?

    .htaccess code ?

    Intermediate & Advanced SEO
    2 2 485
    • 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.
    • seoug_2005
      seoug_2005 last edited by

      What is the code to redirect

      www.xyz.com/abc where abc is a folder  to  www.xyz.com/abc.html

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

        Hey Atul

        There is a really good cheat sheet here:

        http://www.addedbytes.com/cheat-sheets/mod_rewrite-cheat-sheet/

        It shows you the most common things you will need to do and is certainly worth printing off and super glueing to the wall next to your desk. 🙂

        So, looking at the sheet (and you really have  to learn this stuff rather than luck it through else you will end up going around the bend when something does not work as you want it to) a basic rewrite works as follows:

        RewriteRule ^page.html$ new_page.html [R=301,NC,L]

        So, to make this work for you

        RewriteRule ^page.html$ new_page.html [R=301,NC,L]

        But, that is, assuming I understood your question and you are actually looking to redirect A to B and not to just create a nicer URL by masking the /abc/ as /abc.html in which case this is the basics for creating a pretty URL

        RewriteRule ^([A-Za-z0-9-]+)/?$ categories.php?name=$1 [L]

        • that is for a more dynamic page with a querystring but the theory is the same.

        Maybe if  you provided an exact example I can give you one example to build on?

        Hope it helps!

        Marcus

        1 Reply Last reply Reply Quote 3
        • 1 / 1
        • First post
          Last post
        • Htaccess maximum size?
          KevinBudzynski
          KevinBudzynski
          0
          2
          264

        • Htaccess redirect veriables
          NoisyLittleMonkey
          NoisyLittleMonkey
          0
          3
          96

        • Quick htaccess question
          Modi
          Modi
          0
          3
          130

        • .htaccess newby
          GlobalLingo
          GlobalLingo
          0
          16
          334

        • 301 Redirect htaccess
          Christy-Correll
          Christy-Correll
          0
          8
          256

        • .htaccess files
          JamesFx
          JamesFx
          0
          4
          294

        • Do you have to disclose an affiliate code?
          jlane9
          jlane9
          0
          5
          408

        • Autoapprove code
          nyanainc
          nyanainc
          0
          2
          404

        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