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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:54:27+00:00 2026-05-27T08:54:27+00:00

I’m no hero with .htaccess, but I’m experiencing a problem that I think might

  • 0

I’m no hero with .htaccess, but I’m experiencing a problem that I think might be caused by it.
The first symptoms: simple changes to my database (like user IP tracking) got done multiple times per request, while the output by the site looks just fine.

After hours of tracing the problem I finally came to the conclusion that this wasn’t caused by the database itself (100% sure) and also not by the extremely simple piece of PHP code I wrote (also 100% sure).
Still, the problem occurred on different servers. My only conclusion is that it has to do with my .htaccess files.
To me it seems like each request is handled a couple of times before the run that actually causes output.

In my public_html folder I placed the following .htaccess file, which is supposed to redirect every request to a “public” folder:

    <IfModule mod_rewrite.c>
        RewriteEngine on
        RewriteRule    ^$    public/    [L]
        RewriteRule    (.*) public/$1    [L]
    </IfModule>

In that “public” folder I have another .htaccess file:

    <IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ index.php?requestedurl=$1 [PT,L]
    </IfModule>

This file is meant to handle every request using an index.php file.
Note: If I rename the index.php file and access it directly, the problem does not occur.

I simply don’t get this behaviour and I was hoping anyone on this planet does.
Thanks in advance,
Hans

  • 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-27T08:54:28+00:00Added an answer on May 27, 2026 at 8:54 am

    Theoretically no, all the rewrite rules get processed before any file is ever executed. The only thing that could cause multiple recalls to the database is faulty PHP code, which could be calling a line multiple times or possibly redirecting the page after the call, and then the htaccess is redirecting it back to the same page. An htaccess file alone could never do this.

    I would not rule out the possibility, because programs and such can do some very random things at times, but you need to debug your PHP code more in order to eliminate it as the source. The easy way is to simply go through and every time PHP does something major, add a print line to indicate that it is executing some certain function, especially for MySQL commands. This is a quick way to see what all it is doing for that page load. You can be surprised what you find sometimes.

    Also, look through your Apache access log. It will print a new line for each GET request sent by the user. If the page is never redirected, it’s not possible that the script was run multiple times by the user (as pointed out above, no file is executed until the final path is determined). If you’re seeing multiple GET requests from the same IP at the same time, something is redirecting or reloading the page.

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

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
I am doing a simple coin flipping experiment for class that involves flipping a
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Seemingly simple, but I cannot find anything relevant on the web. What is the
I'm making a simple page using Google Maps API 3. My first. One marker
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function

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.