Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8554811
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T14:58:07+00:00 2026-06-11T14:58:07+00:00

We are migrating to a new server structure and I need some help with

  • 0

We are migrating to a new server structure and I need some help with htaccess. I’m a php programmer and by no means an apache expert.

Here is the plain explanation:

  • I need the root directory of http://www.oldsite.com to redirect to the root directory http://www.newsite.com.

  • A specific directory http://www.oldsite/dir1 to redirect to a subdomain on the new site as in newdomain.newsite.com

  • Everything else http://www.oldsite.com/whatever/ needs to go to apps.newsite.com/whatever/

What I have right now is:

Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteRule / http://www.newsite.com [L,R=301]
RewriteRule (.*)dir1/ http://newdomain.newsite.com [L,R=301]
RewriteRule (.*)$ http://apps.newsite.com/$1 [L,R=301]

But its not working as I want it to…

Anyway, any and all help will be appreciated.

Thanks,
-Orallo

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T14:58:08+00:00Added an answer on June 11, 2026 at 2:58 pm

    Using mod_alias, you can put this in either server/vhost config or in your htaccess file (in your document root of the oldsite.com):

    Redirect 301 /dir1 http://newdomain.newsite.com
    RedirectMatch 301 ^/(.+)$ http://apps.newsite.com/$1
    RedirectMatch 301 ^/$ http://www.newsite.com
    

    As for mod_rewrite, you need to remove the leading slashes from your rewrite rules since you are using them in an htaccess file:

    RewriteEngine On
    RewriteBase /
    RewriteRule ^$ http://www.newsite.com [L,R=301]
    RewriteRule ^dir1/(.*) http://newdomain.newsite.com/$1 [L,R=301]
    RewriteRule ^(.+)$ http://apps.newsite.com/$1 [L,R=301]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm migrating a old (circa 2001) PHP 3 app to a new PHP5 server.
I am in process of migrating my old domain to new domain using Apache
We have a server farm that we are slowly migrating to a new version
I am migrating websites to a new server and one site that is using
I'm maintaining some CGI web applications, which I'm migrating to a new Linux web
I'm migrating some stuff from one mysql server to a sql server but i
We are migrating to a new server running Windows 2003 and IIS 6. When
I'm migrating my WordPress blog and phpBB Forum into a new hosting server. I
I'm currently migrating a Magento installation to a new, separate server and I was
Came across something strange while migrating to my new server. I have a script

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.