Skip to content

Website & Server Help

Unlimited Webspace Help

Menu
  • Home
  • Apps
  • Website
    • Sending email from a WordPress website hosted on an IONOS server
    • How to increase Upload Max Filesize
    • How to reset a WordPress password
    • 22 Ways To Speed-Up A Plesk Website
  • Server
    • Linux or Plesk Server Error 500
    • Windows Server: File cannot be loaded. The file is not digitally signed.
    • Adding or modifying IP addresses on a Linux server
    • Installing Remote Desktop on Debian 12
    • Installing Remote Desktop on Ubuntu 22.04
    • How To Install a Let’s Encrypt SSL in Apache on Debian/Ubuntu
  • Favs
    • How to Connect to a Server
    • The Ultimate Guide to Setting Up a Proper Plesk Email Server With IONOS
    • The Ultimate IONOS Migration Guide
    • Help! My Plesk Websites Are Down!
    • Running tests for a slow server or dropped packets
    • Checking File System and Hard Drive Health
Menu

Fix: %20 in URL causes 403 Forbidden Error

Posted on June 27, 2024June 27, 2024 by admin

If you are receiving a 403 Forbidden error on a page when trying to access a page with a space URL encoded as %20, follow along for the fix.

Problem

Accessing example.com/index.php?query=two words will resolve to a URL encoded version of example.com/index.php?query=two%20words . This page results in a 403 Forbidden error.

Diagnostics

Accessing example.com/index.php?query=two+words works properly.

$ wget https://www.example.com/index.php?query=two%20words--2024-06-27 16:27:21-- https://www.example.com/index.php?query=two%20wordsResolving www.example.com (www.example.com)… 1234:f1c1:123f:f987::1f1, 12.123.234.123Connecting to www.example.com (www.example.com)|1234:f1c1:123f:f987::1f1|:443… connected.HTTP request sent, awaiting response… 403 Forbidden2024-06-27 16:27:21 ERROR 403: Forbidden.

Solution

A likely cause is your .htaccess file.

Open the .htaccess file in your website’s home/root/public_html directory using your favorite text editor, and find the line that looks similar to:

RewriteRule (.*)$ /index.php?path=$1 [NC,QSA,L]

Edit this line to add the B flag, which instructs RewriteRule to escape non-alphanumeric characters:

RewriteRule (.*)$ /index.php?path=$1 [B,NC,QSA,L]

Save your .htaccess file, and try reloading your page with URL encoded spaces ( %20 ) again.

Special Offer

The internet's fastest, cheapest, unlimited bandwidth VPS

VPS
1core | 1GB RAM | 10GB NVMe
Unlimited Bandwidth | 1Gbps
$2/month - risk free