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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:18:21+00:00 2026-06-17T09:18:21+00:00

I am trying to create a .htaccess rule to redirect users from one domain

  • 0

I am trying to create a .htaccess rule to redirect users from one domain to the other, but this should happen only if the original URL does not exist. For example:

  • www.domain.com/100 to www.otherdomain.com/PersonalPages/100
  • www.domain.com/150 to www.otherdomain.com/PersonalPages/150

Now, I don’t have a page/file named 100 or 150, so that’s why it should redirect, but if user enters “www.domain.com” I do have “index.php” and should stay in “www.domain.com” and not try to go to “www.otherdomain.com/PersonalPages/index.php” (or any other if page exist in my http://www.domain.com)

I know I can create a simple 301 redirect, but the numbers in the URL are the IDs of users and that number will grow on a daily basis so I can’t be adding lines of redirects to my .htaccess for each new user.

Is there a 404 code I could use?

  • 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-17T09:18:22+00:00Added an answer on June 17, 2026 at 9:18 am

    I think this will work for you:

    RewriteRule ^([0-9]+)$ http://www.otherdomain.com/PersonalPages/$1
    

    ^ and $ mark the beginning/end of the url, [0-9]+ stands for one or more numbers between 0 and 9.

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

Sidebar

Related Questions

I am trying to create a rewrite rule that accomplishes two things: Redirect (www.)?domain.com
Trying to create a .htaccess redirect results in an infinite loop. This is what
I'm trying to create an conditional Rewrite Rule using an .htaccess file and Apache.
I am trying to create an htaccess file to redirect my entire site except
I am trying to create dynamic subdomains in .htaccess. I want something like this:
I am trying to create a RewriteRule in htaccess for the domain root without
I'm trying to create some redirects with .htaccess but I never manage to get
I'm trying to create a rule used in a .htaccess file to match anything
I'm trying to create a redirect from http://example.com/links/AAA to http://links.example.net/l/AAA (where AAA is a
i am trying to create an .htaccess file that will achieve the following create

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.