How to forward all requests starting with a specific folder name to the same folder


In my WordPress website main directory, I created a folder servers, which contains two files .htaccess & index.php.

In the .htaccess file, I add those lines to redirect all requests to that folder to the index.php file.

# Enable rewriting.
RewriteEngine on

# Optional: do not allow perusal of directories.
Options -Indexes

# Optional: explicitly enable per-directory rewrites in the .htaccess context.
Options +FollowSymLinks

# Required when not in the webroot. Always use a trailing slash.
RewriteBase /

# To be able to access existing directories and files (standalone scripts).
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f

# Redirect everything else to index.php.
# Add QSA to ensure that querystring variables are registered as such.
RewriteRule . index.php [L,QSA]

# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php72” package as the default “PHP” programming language.
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php72 .php .php7 .phtml
# php -- END cPanel-generated handler, do not edit

So whenever a user requests a link like, or, the default WordPress website should load. and when I request any url that starts with the servers folder:,,, I want the example/com/servers/index.php file to be executed.

The current file only executes this url with the file but it’s not executing other urls that start with the servers folder(, by the file.

How can edit the htaccess file so that all request to* are executed by the file

, Yazan W Yusuf 3 years 2020-07-11T07:10:38-05:00 0 Answers 39 views 0

Leave an answer