.htaccess 301 code help

Posted on 2014-08-28
Last Modified: 2014-08-28

Could anyone help me write a piece of .htaccess code.

We currently have a blog hosted as a subdomain and have managed to get it mirrored across to a subfolder for SEO purposes. I now need to write the htaccess code such that ALL PAGES of the blog are 301'd across to the relevant subfolder pages as in the example below:

Current Structure

New Structure:

Thanks for your help
Question by:ChilliSauce
    LVL 18

    Accepted Solution

    RewriteEngine On
    RewriteBase /
    RewriteRule ^(.*)$$1 [R=301,QSA,L]
    LVL 18

    Expert Comment

    Forgot, that goes in the root of you subdomain

    Author Comment

    Forgot, that goes in the root of you subdomain

    Sorry do you mean that the .htaccess file that contains this code should be in the root of the subdomain??

    LVL 18

    Expert Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Article by: kevp75
    Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
    If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
    Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
    The viewer will learn how to dynamically set the form action using jQuery.

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now