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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T12:21:51+00:00 2026-06-07T12:21:51+00:00

I have an application that I have rewritten with rails. Old application is in

  • 0

I have an application that I have rewritten with rails. Old application is in php.

I need to redirect all php requests to a subdomain old.example.com (I have put my old application to run there) so that the old links would still work. I believe all of the links have a “.php” in them and none of my new urls have that. So it could be used as a condition for redirecting.

I have planned to use apache RedirectMatch. So something like:

RedirectMatch \.php http://old.example.com

should be close. I believe. I just don’t know how to pass the request path to the redirect rule.

Or if someone has a better idea how to do this?

  • 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-07T12:21:53+00:00Added an answer on June 7, 2026 at 12:21 pm

    Using Apache mod rewrite, you would use the following:

    RewriteEngine On
    RewriteBase /
    RewriteRule ^.*\.php.*$ http://old.example.com/index.php [R=301,NC]
    

    If you want to actually insert the page they were trying to reach in the redirect URL:

    RewriteEngine On
    RewriteBase /
    RewriteRule ^/?(.*)\.php.*$ http://old.example.com/$1.php [R=301,NC]
    

    $1 will insert anything that matches the regular expression in the parentheses.

    For GET parameters:

    RewriteEngine On
    RewriteBase /
    RewriteRule ^/?(.*)\.php(.*)$ http://old.example.com/$1.php$2 [R=301,NC]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application that routes all requests through index.php . Here's my setup:
I am building a Rails application that contains Developer s who have Application s.
I have a legacy PHP application that uses the following URL structure /product_info.php?products_id=YYY where
I'm using MVC with /<module>/<controller>/<action>/ have a module at example.com/module/whatever, and I need to
I have a rails 2.3.9 application that i'm migrating to rails 3. As almost
I have a custom HttpModule rewrite engine in an existing web application project that
I have application that makes different queries with different results so the caching in
I have application that is connecting to the DB and if I enter incorrect
I have application that is up more than 3 days. I can see in
I have application that brings response via Ajax and creates 5-20 new jQuery click

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.