Search code examples
phpapache.htaccessdrupal-6http-status-code-403

%20 in URL is now causing ERROR 403 FORBIDDEN Errors


This is not a duplicate question.

First of all, I have 3 "identical" Drupal 6.20 CMS desktop type websites using MySQL database 5.7.23 and PHP 5.6.40.

All 3 of these sites have been around for many years, and have never experienced this problem before.

Recently 2 of the 3 websites, (Site 1) http://sam308.com/ and (Site 2) http://closefocusresearch.com/ built in searches have been experiencing this exact same problem.

The problem is:

For example, on http://closefocusresearch.com/, When I use the built in search form on the website, and use a two-word term such a "body armor" without the quotes, or use any multiple word search term that includes spaces, the search results display the message ERROR 403 - FORBIDDEN. However, the search result url below has not changed.

The search result url for this page is:

http://closefocusresearch.com/search/node/body%20armor

Before this problem started happening, the above search results url would display the proper search results.

Now, the %20 in the url is causing the ERROR 403 - FORBIDDEN result as shown in the image below.

Since the space between the two words, body armor, has been replaced with a %20, I'm now experiencing resulting in the 403 error. This only happens if the search terms contains spaces, and otherwise works fine.

As a side note, if the manually replace the %20 with %2520, replacing the % with %25 in the url, as shown below, then I get the proper search results.

http://closefocusresearch.com/search/node/body%2520armor

If you want to test it for yourself, then use the site search box on the home pages.

I spent the last 3 days trying to find the cause this behavior on both the internet and at drupal.org, but could not find a solution. All the file permissions on all 3 websites are the same.

I also tried getting support from my hosting company, but they could not offer any help.

I also tried modifying the .htaccess file to correct this behavior, but had no luck. I'm not an expert in writing RewriteRule rules.

Could it be a recent Apache update bug causing this problem? Note: I cannot access the Apache system on a shared hosting plan.

Any ideas on how to fix this problem?

Thank you for your time.

ERROR 403 - FORBIDDEN result


Solution

  • I followed the instructions here, and looks like that solved the issue: AH10411 error: Managing spaces and %20 in apache mod_rewrite

    Change your .htaccess from:

    RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
    

    to:

    RewriteRule ^(.*)$ index.php?q=$1 [B,L,QSA]