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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T10:09:33+00:00 2026-05-31T10:09:33+00:00

Here is what I am trying to do: When a file is requested from

  • 0

Here is what I am trying to do:

  • When a file is requested from filesystem and it does not exist, rewrite the URL to /index.php?404
  • When file is requested and it does exist in filesystem, rewrite the URL to /index.php?file
  • In every other case rewrite the URL to /index.php?data

But I am getting 500 errors as a result, does anyone know where the problem might be? I have used RewriteEngine in the past, but it’s still a bit confusing to me regarding how to use it for special cases like this.

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} (.*\.([a-zA-Z]{2,4}))$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* ./index.php?404 [L]

RewriteCond %{REQUEST_FILENAME} (.*\.([a-zA-Z]{2,4}))$
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule .* ./index.php?file [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* ./index.php?data [L]
  • 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-05-31T10:09:34+00:00Added an answer on May 31, 2026 at 10:09 am

    You have infinite rewrite loop. To solve — add extra condition to not rewrite already rewritten URLs .. or at least ignore requests to index.php.

    One of the possible approaches:

    # do not touch any requests to index.php
    RewriteRule ^index\.php$ - [L]
    

    P.S.
    How L flag works: RewriteRule Last [L] flag not working?

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

Sidebar

Related Questions

So here's the deal: I'm trying to open a file (from bytes), convert it
I'm trying to play a sound file from an iPhone program. Here's the code:
I'm trying to access CodeIgniter URLs without 'index.php'. Here's the steps I've taken: Checked
Here's what I'm trying to do. I'm querying an XML file using LINQ to
Here's what I'm trying to do, and failing... I have a File model which
Very confused here, trying out the yuicompressor on a simple javascript file. My js
I'm trying to deploy a service that I wrote. Here's the InstallLog file: Installing
I'm working on a code I requested from a researching team. I'm trying to
I'm trying to download a file from the web and save it locally, but
I'm having a problem here trying to upload a file with powershell. What I'm

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.