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

  • Home
  • SEARCH
  • 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 9178949
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:40:32+00:00 2026-06-17T17:40:32+00:00

I want to rewrite test.com to test.com/context. The browser returns redirection recursion error. Anyone

  • 0

I want to rewrite test.com to test.com/context.

The browser returns redirection recursion error.

Anyone has a clue?

I put below in httpd-vhosts.conf.

<VirtualHost *:80>
    ServerName test.com

    JkMount /* mschoi
    ErrorLog logs/mschoi-error_log
    CustomLog logs/mschoi-acces_log common

    RewriteEngine On
    RewriteRule ^/(.*)$ /context/$1 [L,R]

</VirtualHost>

httpd.conf
Include conf/extra/httpd-vhosts.conf
  • 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-17T17:40:33+00:00Added an answer on June 17, 2026 at 5:40 pm

    This is a simple case of your rule matching /context again when it rewrites. You can just use a RewriteCond to avoid it:

    RewriteEngine On
    # Rewrite only if the request doesn't already match /context
    RewriteCond %{REQUEST_URI} !^/context
    RewriteRule ^/(.*)$ /context/$1 [L,R]
    

    If the files being accessed actually exist (rather than a rewrite pattern) you can test for and not rewrite any real existing files:

    RewriteEngine On
    # If the requested resource is not actually a real file or directory (doesn't exist)
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^/(.*)$ /context/$1 [L,R]
    

    Edit after comment to explain:

    Not only per-directory rules can cause recursion. In this case, it is the simple matter that /(.*) matches anything and that gets appended unconditionally to /content. Since the [R] flag is present to redirect and each of these is a new request, it becomes a redirection chain of :

    /something
    /content/something
    /content/content/something
    /content/content/content/something
    

    Subsequent redirects always continue to match the leading /content as well as what follows with /(.*) and append to it.

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

Sidebar

Related Questions

I want to rewrite requests like: mydomain.com/this/is/a/test to: mydomain.com/url.php?i=this,is,a,test How can I write a
I want to rewrite www.domain.com/s/index.php?s=test into test.domain.com I did it successfully in local host
want to rewrite urls like site.com/software to wp-content/themes/dir/software.php and something is not working.. Here's
I want to rewrite from http://example.com/blah/<something>/<somethingelse> to http://<something>.example.com/<somethingelse> , but only if the request
I want to rewrite http://website.com/?slug=product_info.php&products_id=32 to http://website.com/product_info/32 and I use this code, add_filter('rewrite_rules_array','wp_insertMyRewriteRules'); add_filter('query_vars','wp_insertMyRewriteQueryVars');
I have this URL example.com/photo?people I want to rewrite this URL in the form
hi i want something like this when user write www.test.com/6 in the behind it
I have this rewrite rule that turns foo.com/test (or foo.com/test/) into foo.com/test.txt: RewriteRule ^test/?$
I want to rewrite everything that uses this pattern... /test/?TEXT=TRUE and allow it to
For my site I have a directory called /test/ . I want to rewrite

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.