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 6975175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:20:04+00:00 2026-05-27T17:20:04+00:00

Hi guys trying to get a 301 redirect working and having trouble. I need

  • 0

Hi guys trying to get a 301 redirect working and having trouble. I need to redirect sub.domain1.com to http://www.domain2.com and make sure that any file names or parameters get sent over with it.

This is what I was trying:

RewriteCond %{HTTP_HOST} ^domain1.com [NC] 
RewriteRule ^(.*)$ http://www.domain2.com/$1 [L,R=301] 

I also tried this:

RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^sub\.domain1\.com$ /www.domain2.com? [R=301,NE,NC,L]

Where am I messing up?

  • 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-05-27T17:20:05+00:00Added an answer on May 27, 2026 at 5:20 pm

    Rule of thumb for rewriterules: from the most complex to the less complex.
    And don’t forget the QSA directive (QSA = Query String Append = “make sure that any file names or parameters get sent over with it”)

    RewriteCond %{HTTP_HOST} ^sub\.domain1\.com$ [NC]
    RewriteRule ^(.*)$ http://www.domain2.com/$1 [QSA,R=301,L]
    

    Tell me if it works.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Well guys, I'm trying to get that MongoDB feature working for hours: http://www.mongodb.org/display/DOCS/Http+Interface I
Hi guys I'm running through this tutorial: http://www.sencha.com/learn/a-sencha-touch-mvc-application-with-phonegap and trying to get the code
Hey guys and gals I'm having some major issues trying to get my application
Hi guys just a quick question, After having a nightmare trying to get an
Hi guys ive been trying to get smooth scrolling working on my anchors for
I am trying to get this jGrowl working but I am not having any
I am having real trouble trying to get decent answers to my questions from
Good evening guys. I'm currently trying to get started on development of a project
Hi guys i am trying to build a jni library. The build is working
Hi guys i am trying to create one simple make file and execute in

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.