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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:59:34+00:00 2026-06-11T22:59:34+00:00

what i am trying to do is this: If url http://example.com/foo/foo.php is called it

  • 0

what i am trying to do is this:

If url http://example.com/foo/foo.php is called it should be redirected with 301 to http://example.com/bar/foo.php

AND

if url http://example.com/bar/foo.php is called it internally calles the /bar/foo.php script but browser url is not changed (remap).

my rules look like this

RewriteRule ^foo/foo.php(.*) bar/foo.php$1 [R=301]
RewriteRule ^bar/foo.php(.*)$ foo/foo.php$1 [PT]

But this gives me too many redirects error.

Each rule activated separately works but together they seem to conflict…

  • 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-11T22:59:35+00:00Added an answer on June 11, 2026 at 10:59 pm

    You can either match against the actual request:

    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /foo/foo.php
    RewriteRule ^foo/foo.php(.*) bar/foo.php$1 [R=301]
    RewriteRule ^bar/foo.php(.*)$ foo/foo.php$1 [L]
    

    Or prevent rewrite looping altogether:

    RewriteCond %{ENV:REDIRECT_STATUS} !200
    RewriteRule ^foo/foo.php(.*) bar/foo.php$1 [R=301]
    RewriteRule ^bar/foo.php(.*)$ foo/foo.php$1 [L]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to rewrite a url of this: http://www.foo.com/bar/baz to index.php?q=$1&d=baz Where bar is
I'm trying to rewrite this url: http://www.example.com/user.php?user=username into http://example.com/username I'm using this code in
I am trying to rewrite this url: http://www.sample.com/product_guide&product_name=waht&product_type=dog-clipper to: http://www.sample.com/waht/dog-clipper I am using this
I'm trying to match the '12345' from a url in this form: http://domain.com/folder/title_of_this_12345 So
I am trying to grab the last part of the current url: URL: http://example.com/test/action
Here's an example of what I'm trying to do. Turn this: http://example.com/products/ into this:
Here is my issue. I am trying to call a page: foo.php?docID=bar and return
I'm trying to search for a variable value in my URL using php. This
I'm trying to echo the XML content at this URL but I'm having difficulty.
Im trying to get some auto complete to work. I have this URL i

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.