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. How can I perform this 301 redirect?

    How can I perform this 301 redirect?

    Technical SEO Issues
    5 5 387
    • 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.
    • GrassRootsSEO
      GrassRootsSEO last edited by

      I am working on a site for a colleague and have installed wordpress on their server in the wp directory, they want the root domain redirecting to the wp directory but everything i have tried seems to throw up errors.

      i need sample.co.uk to redirect to sample.co.uk/wp/ no matter which html file they are trying to access on the root of the sample.co.uk site

      help?

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

        You must have installed the wordpress on some folder rather than the root of  your website.

        So if you want to redirect all the traffic form “sample.co.uk” to “sample.co.uk/wp/” then use the following codes on the .htaccess file on the root (sample.co.uk/)

        <ifmodule mod_rewrite.c="">RewriteEngine On
            RewriteRule ^$ /wp/ [R=301]</ifmodule>

        OR

        RewriteEngine on
            RewriteRule ^([/]+)$ wp/$1 [L,R=301]

        OR

        RedirectMatch permanent ^/$ http://sample.co.uk/wp

        Although I will recommend to use the 1st one.

        ProjectLabs 1 Reply Last reply Reply Quote 2
        • JamesFx
          JamesFx last edited by

          There's a great htaccess file generator at http://www.htaccessredirect.net/

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

            Also, you can install the this word press plugin http://yoast.com/wordpress/seo/.

            Works very well and has an option in the plugin menu to make redirect changes to your htaccess file for redirecting pages.

            The string to add in is:

            redirect 301 "/page-name.html"  http://wwwdomain-name.com

            1 Reply Last reply Reply Quote 0
            • ProjectLabs
              ProjectLabs @Visiblics last edited by

              Does this work for both Linux server software and Microsoft server software? Should there already be an .htaccess file or do you usually have to upload it to the server files via FTP?

              1 Reply Last reply Reply Quote 0
              • 1 / 1
              • First post
                Last post
              • Can a page that's 301 redirected get indexed / show in search results?
                Colemckeon
                Colemckeon
                0
                3
                43

              • 301 Redirects Showing As 307 Redirects
                0
                1
                64

              • Can I use a 301 redirect to pass 'back link' juice to a different domain?
                TucsonAZWebDesign
                TucsonAZWebDesign
                0
                4
                4.8k

              • Can new content be added to a url which has a 301 redirect?
                AlanMosley
                AlanMosley
                0
                7
                129

              • Redirect a 301 Redirect
                RedCaffeine
                RedCaffeine
                0
                5
                98

              • 301 redirects reverting to 302 redirects
                Devanur-Rafi
                Devanur-Rafi
                0
                6
                532

              • Moving articles to new site, can't 301 redirect because of panda
                philray
                philray
                0
                5
                408

              • Can you do a 301 redirect without a hosting account?
                TitanDigital
                TitanDigital
                0
                6
                28.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