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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:24:49+00:00 2026-05-30T20:24:49+00:00

RewriteEngine On RewriteCond %{HTTP_HOST} ^www.new.domain.com [NC] RewriteRule ^(.*)$ http://new.domain.com/$1 [L,R=301] why when i enter

  • 0
RewriteEngine On

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

why when i enter http://www.new.domain.com is not redirected to http://new.domain.com?

The .htaccess file is in the right folder (it has more rewritecond’s and they work)

  • 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-30T20:24:50+00:00Added an answer on May 30, 2026 at 8:24 pm

    The regexp syntax in your RewriteCond is slightly broken: the correct way to test for strict equality with www.new.domain.com (up to differences in case) is either

    RewriteCond %{HTTP_HOST} ^www\.new\.domain\.com$ [NC]
    

    or

    RewriteCond %{HTTP_HOST} =www.new.domain.com [NC]
    

    That said, those errors should not stop your rewrite rule from working: you original RewriteCond will match www.new.domain.com just fine, it just matches some other strings too (like wwwXnewYdomainZcomFOOBAR). In fact, I have a very similar set of rules in my own .htaccess file, and they work just fine:

    RewriteEngine On
    RewriteBase /
    
    RewriteCond %{HTTP_HOST} !^vyznev\.net$
    RewriteCond %{HTTP_HOST}  ^(www\.)?vyznev\.net$ [NC]
    RewriteRule ^(.*) http://vyznev.net/$1 [NS,L,R=permanent]
    

    Most of the differences between your code and mine are purely cosmetic. The only potentially significant issue I can see if that you don’t have a RewriteBase directive; you should definitely add one, if only to avoid potential problems later. Still, as far as I can tell, not having one shouldn’t stop you from getting at least some redirect, even if it might not be to the URL you expect.

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

Sidebar

Related Questions

I have the following .htaccess file. RewriteEngine on RewriteCond %{HTTP_HOST} !^www\.mysite\.com$ RewriteRule ^(.*)$ http://www.mysite.com/$1
Options +FollowSymlinks RewriteEngine On RewriteCond %{HTTP_HOST} ^http://agilerent.com$ [NC] RewriteRule ^(.*)$ http://www.agilerent.com/$1 [R=301,L] this is
The following .htaccess file does not work: SSLrequireSSL RewriteEngine on RewriteCond %{HTTP_HOST} !^secure\.neuralfutures\.com [NC]
I have the following redirects in my htaccess file Redirect 301 /communityed/index.htm http://www.domain.com/community_education Redirect
I have this: Options -Indexes RewriteEngine On RewriteCond %{HTTP_HOST} ^findmyfiver\.com$ RewriteRule (.*) http://www.findmyfiver.com/$1 [L,R]
I now have : RewriteEngine On RewriteCond %{HTTP_HOST} !^domain.co.uk$ [NC] RewriteRule ^(.*)$ http://domain.co.uk/$1 [L,R=301]
My dilema: In .htaccess in my website's root: RewriteEngine On RewriteCond %{HTTP_HOST} !^www\.example\.com [NC]
Here's what my htaccess looks like: RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^www.site.com$ [NC]
I am using this .htaccess code for my website RewriteEngine On RewriteCond %{HTTP_HOST} !^www.website.com$
My current htaccess looks like this: RewriteEngine On RewriteCond %{HTTP_HOST} ^(www\.)?site\.com [NC] RewriteCond %{REQUEST_FILENAME}

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.