Answer the question
In order to leave comments, you need to log in
How to specify the condition for selecting only subpages in the htacces file in RewriteCond?
There are pages starting with /auxpage_
Example: /auxpage_kontakty/ and /auxpage_kak-zakazat/
Question: how to write a condition in .htacces, that is, RewriteCond, so that all subpages of such pages would be selected.
Where it all goes: all subpages of pages that start with auxpage_ should give 404.
I tried many options, but none came up.
Here are code examples:
#RewriteCond %{REQUEST_URI} ^/auxpage_(.*)/(.*)
#RewriteCond %{REQUEST_URI} !^/auxpage_(.*)/$
##-- RewriteCond %{REQUEST_URI} ^/auxpage_.*/(.*)
##-- RewriteCond %{REQUEST_URI} !^/auxpage_.*/$
#-- RewriteCond %{REQUEST_URI} ^/[auxpage]*/(.*)
#-- RewriteCond^([^/]*)/$
#-- RewriteCond %{REQUEST_URI} ^/auxpage_[a-Z0-9]/(.*)
#-- RewriteCond %{REQUEST_URI} !^/auxpage_(.*)/$
#RewriteRule ^(.*)$ [R=404]
Answer the question
In order to leave comments, you need to log in
RewriteCond %{REQUEST_URI} ^/auxpage_.+/.+$
RewriteRule ^ - [R=404,L]
RewriteRule ^auxpage_.+/.+ -
RewriteCond %{REQUEST_URI} ^auxpage_.+/.+$
Alternatively, you can also do denial
RewriteCond %{REQUEST_URI} !^^auxpage_.+\/$
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question