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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:21:15+00:00 2026-05-25T06:21:15+00:00

I am trying to redirect traffic coming from a specific domain inside my .htaccess

  • 0

I am trying to redirect traffic coming from a specific domain inside my .htaccess file. It works fine unless I do this for a domain with a .to extension. Any idea what is going on here?

Produces error 500:

RewriteCond %{HTTP_HOST}            ^(www\.)?domain\.to [NC]
RewriteRule ^.*$                    /foo/bar [L]

Works fine:

RewriteCond %{HTTP_HOST}            ^(www\.)?domain\.com [NC]
RewriteRule ^.*$                    /foo/bar [L]
  • 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-25T06:21:16+00:00Added an answer on May 25, 2026 at 6:21 am

    Since I do not know for sure which rule does produce rewrite loop, I can only suggest this approach at this moment:

    RewriteCond %{HTTP_HOST} ^(www\.)?domain\.to [NC]
    RewriteCond %{REQUEST_URI} !^/foo/bar
    RewriteRule ^.*$ /foo/bar [L]
    

    Your attempt is not technically correct for 2 reasons:

    • in .htaccess URL will be without leading slash (I’m referring to $1);
    • you are using $1 .. but you have no matching group setup (in other words $1 will always be empty).

    If still nothing — please provide real htaccess … or try enabling rewrite debugging (RewriteLogLevel 9) — but for this you have to have full control over Apache server, as this directive cannot be placed in .htaccess (only server config / virtual host context) + you will need to restart Apache to re-read configuration file.


    Try adding this rule somewhere on the top — where it will be appropriate:

    # do not do anything for already existing files
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule .+ - [L]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to redirect all traffic through index.php. Here is my .htaccess file:
Trying to redirect all traffic from www.old-domain.co.uk and old-domain.co.uk to www.new-domain.co.uk on a Wordpress
I want to use htaccess to redirect all traffic from www.oldsite.com/directory to www.newsite.com I
I'm trying to redirect pages from several old domains on one new domain on
I'm trying to redirect my clients from: /media/pdf/pds/.../file.pdf -> /media/pdf/pds/English/.../file.pdf My current approach, witch
I am trying find out how to redirect all traffic on a website from
I'm trying to redirect any non-www prefixed traffic to the www prefixed domain. I'm
I'm trying to redirect this page Page to a Jquery mobile website that I'm
I'm trying to redirect a few pages to a new domain and I have
We've been trying to redirect from one action to another, hoping that data would

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.