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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:13:00+00:00 2026-06-08T18:13:00+00:00

RewriteRule ^resources/.+$ – [L] RewriteRule .? index.php?t=$0 [QSA,L] Would produce a 500 – Internal

  • 0
RewriteRule ^resources/.+$ - [L]

RewriteRule .? index.php?t=$0 [QSA,L]

Would produce a 500 - Internal Server Error, because it would repeat again and again the same rule, due to internal redirected requests which are exactly treated as the first one. It would lead to an infinite chain of index.php?t=index.php&t=index.php&t=index.php&[...infinite more...]&t=test.php

But in my opinion this is not much better:

RewriteRule ^resources/.+$ - [L]

RewriteCond %{QUERY_STRING} !t=
RewriteCond %{REQUEST_URI} !^index\.php$
RewriteRule .? index.php?t=$0 [QSA,L]

Because now the user could input index.php?t=test.php as address, would pass the script and get the same content as if he had given test.php. I don’t like that.

So how do I execute the first one without the issue of repeating internal redirects?
Surely, a flag VL – Very Last would do the trick but sadly it does not exist.

  • 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-08T18:13:01+00:00Added an answer on June 8, 2026 at 6:13 pm

    First we have a look at all parameters given to the rules possibly indicating whether this is a chained request or not. This means, we either 1) need a variable changed in chained requests not relative to the changed URI or 2) the opposite, a variable which is relative to the changed URI and did not change (because we can compare it then against the others who did chage).

    The problem is, they almost all update according to the applied RewriteRules.

    IS_SUBREQ (1) and THE_REQUEST (2) are the only interesting variables but sadly internal redirects are not treated as subrequests, so IS_SUBREQ disappears. Only THE_REQUEST does not change and contains the real given path, so we have found our entry point.

    With this in mind here is the annoying complex solution:

    RewriteEngine On
    
    # Set SCRIPT_URI and SUBREQ
    # MUST be the first statements in the file
     # SCRIPT_URI is the original browser-requested path
     # SUBREQ is "true" if the original browser-requested path is not overriden yet
    
     RewriteCond %{ENV:REQUEST_PARSED} !true
     RewriteCond %{THE_REQUEST} ^\s*\w+\s+(http://[^\s/]+/|/?)([^\s\?]*)[\s\?$]
     RewriteRule .? - [E=SCRIPT_URI:/%2,C]
     RewriteRule .? - [E=REQUEST_PARSED:true]
    
     RewriteCond %{ENV:SCRIPT_URI} ^(.*?)/\.($|/.*$)
     RewriteRule .? - [E=SCRIPT_URI:%1%2,N]
    
     RewriteCond %{ENV:SCRIPT_URI} ^(.*?)/[^/]+/\.\.($|/.*$)
     RewriteRule .? - [E=SCRIPT_URI:%1%3,N]
    
     RewriteCond %{ENV:SCRIPT_URI} ^(.*?)//\.\.($|/.*$)
     RewriteRule .? - [E=SCRIPT_URI:%1/%2,N]
    
     RewriteCond %{ENV:SCRIPT_URI}#%{REQUEST_URI} !^/*(.*)#/*\1$
     RewriteRule .? - [E=SUBREQ:true]
    
    # SCRIPT_URI and SUBREQ are set now. Actual content follows:
    
    RewriteCond %{ENV:SUBREQ} !true
    RewriteRule ^resources/.+$ - [L]
    
    RewriteCond %{ENV:SUBREQ} !true
    RewriteRule .? index.php?t=$0 [QSA,L]    
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this rules in apache: RewriteRule ^seccion/([^/\.]+)/?$ index.php?tipo=seccion&slug=$1 [L] RewriteRule ^seccion/([^/\.]+)/pag/([0-9]+)$ index.php?tipo=seccion&slug=$1&page=$2 [QSA,L]
My htaccess: RewriteEngine On RewriteRule ^(.*)/(.*)$ /index.php?cat=$1&page=$2 [L] Now my css is located at:
I need a rewriterule so if i type index.html i will show index.php I
I have the following line: RewriteRule ^page.php?var1=([0-9]+)&var2=(.*)&var3=(.*)$ index.php?module=page&var1=$1 When I visit the directory with
RewriteRule ^foo-bar-([0-9]+)-([a-z]+)-([a-z-+]+)/$ index.php?a[]=&b=$1&c=$2&d=$3&e=$4&f=$5 [L,NC] how could i put the last parameter from rule to
This is my rule: RewriteRule ^([^/]+)(/.+)? /negocio$2.php?shopURL=$1 [L,QSA] If $2 doesn't exist (URL doesn't
http://localhost/allsides/.htaccess RewriteRule (.*) index.php?$1 [L] http://localhost/allsides/test One or more chars after allsides/ are saved
RewriteRule ^([^/.]+)?orderby=([^/.]+)&sort=([^/.]+)$ index.php?category=$1&orderby=$2&sort=$3 [L,NC] RewriteRule ^([^/.]+)$ index.php?category=$1 [L,NC] my html code is like this
I have resources for two websites located here... localhost/index.php /* rewrite handler */ localhost/images/
I've got: RewriteRule ^page/([^/\.]+)/?$ index.php?page=$1 [L] Which points page/([^/\.]+)/? to index.php?page=$1 . When 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.