Y
Y
yarovikov2021-09-27 11:52:51
Apache HTTP Server
yarovikov, 2021-09-27 11:52:51

Exclude folder and subfolders from wp url processing?

Hi all. The situation is this:
At the root of the site is a folder with scripts, in which your php scripts. In short - redirects that process incoming links. You need to exclude this folder from processing by WordPress. For example, the script there handles urls like site.com/gogo/ or site.com/gogo/gomore.
If there is no problem with site.com/gogo/, then the wp intercepts links like site.com/gogo/gomore. Here's how to prevent him from processing the go directory on apache at all?
if I enter something like this RewriteCond %{REQUEST_URI} !^/(gogo/.*)$ then for site.com/gogo/gomore The requested URL was not found on this server.
Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
Zettabyte, 2021-09-27
@Zettabyte

Given that you mention the problem with subfolders, you need to try it with your hands.
Try the two lines below, adding them before the RewriteCond %{REQUEST_FILENAME} !-f. This is if you have a standard WordPress .htaccess.
These are two independent options, try one first, then the other. Replace excluded_folderwith the real name of your top folder.

RewriteCond %{REQUEST_URI} !^/(excluded_folder|excluded_folder/.*)$

-or-
RewriteRule ^excluded_folder(/.*)?$ - [L,NC]
Also note later that WordPress likes to overwrite .htaccess, which can mess with your rules.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question