F
F
fStrange2019-12-28 01:23:44
htaccess
fStrange, 2019-12-28 01:23:44

How to make a separate 404 for certain files?

There is a standard WordPress .htaccess

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

Those. 404 is currently being processed by the engine.
I need pages that contain blabla*, for example, to be processed not through the CMS, but directed to a separate static 404.html page.
And the rest of the non-existent ones, let them process the CMS in the same way.
I have a solution through FilesMatch
#для статики отдельную 404
<FilesMatch "\.(gif|jpe?g|png|ico|js|css)$">
#ErrorDocument 404 /small-image-or-blank-file.gif
ErrorDocument 404 "<h1>404 error! File not found!</h1>"
</FilesMatch>

But it is desirable for me through ModRewrite.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Lev Zabudkin, 2019-12-28
@zabudkin

And what exactly is stopping you?
RewriteCond %{QUERY_STRING} (^|&)s\=blabla($|&)
RewriteRule ^where$ /blabla? [L,R=301]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question