Search code examples
.htaccesshttp-status-code-410

410 redirect for all the subdirectories


Via htaccess have to give a 410 gone to all the subdirectories inside the mywebsite.com/tag/ folder. I have tried many codes but nothing worked

EXAMPLES: https://www.mywebsite.com/tag/piazza/feed/ https://www.mywebsite.com/tag/womans-rights/feed/

I've deleted all the tags pages from my website and I want that all of them receive a 410 code because I have an huge amount of not indexed errors into google's search console. I've tried the 410 plugin into wordpress but it doesn't work. I've also tried many codes for htaccess but nothing happened. Thanks a lot.

MAIN HTACCESS

RewriteEngine on
RewriteRule ^/?tag/.* - [G,L]
ErrorDocument 410 default
# BEGIN WpFastestCache
# Modified Time: 21-03-22 15:28:32
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTPS} =on
    RewriteCond %{HTTP_HOST} ^www.mywebsite.it
# Start WPFC Exclude
    RewriteCond %{REQUEST_URI} !elementor [NC]
    RewriteCond %{REQUEST_URI} !/wp-content/plugins/wpforms/assets/js/wpforms.min.js [NC]
    RewriteCond %{HTTP_USER_AGENT} !googletagmanager.com [NC]
    RewriteCond %{HTTP_USER_AGENT} !bingbot [NC]
# End WPFC Exclude
# Start_WPFC_Exclude_Admin_Cookie
    RewriteCond %{HTTP:Cookie} !wordpress_logged_in_[^\=]+\=webmastercaserta
# End_WPFC_Exclude_Admin_Cookie
    RewriteCond %{HTTP_HOST} ^www.mywebsite.it
    RewriteCond %{HTTP_USER_AGENT} !(facebookexternalhit|WP_FASTEST_CACHE_CSS_VALIDATOR|Twitterbot|LinkedInBot|WhatsApp|Mediatoolkitbot)
    RewriteCond %{HTTP_USER_AGENT} !(WP\sFastest\sCache\sPreload(\siPhone\sMobile)?\s*Bot)
    RewriteCond %{REQUEST_METHOD} !POST
    RewriteCond %{REQUEST_URI} !(\/){2}$
    RewriteCond %{REQUEST_URI} \/$
    RewriteCond %{QUERY_STRING} !.+
    RewriteCond %{HTTP:Cookie} !comment_author_
    RewriteCond %{HTTP:Cookie} !safirmobilswitcher=mobil
    RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC]
    RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/%{HTTP_HOST}/all/$1/index.html -f [or]
    RewriteCond /home/aw46l23c/reggia/wp-content/cache/%{HTTP_HOST}/all/$1/index.html -f
    RewriteRule ^(.*) "/wp-content/cache/%{HTTP_HOST}/all/$1/index.html" [L]
##### mobile #####
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTPS} =on
    RewriteCond %{HTTP_HOST} ^www.mywebsite.it
# Start WPFC Exclude
    RewriteCond %{REQUEST_URI} !elementor [NC]
    RewriteCond %{REQUEST_URI} !/wp-content/plugins/wpforms/assets/js/wpforms.min.js [NC]
    RewriteCond %{HTTP_USER_AGENT} !googletagmanager.com [NC]
    RewriteCond %{HTTP_USER_AGENT} !bingbot [NC]
# End WPFC Exclude
# Start_WPFC_Exclude_Admin_Cookie
    RewriteCond %{HTTP:Cookie} !wordpress_logged_in_[^\=]+\=webmastercaserta
# End_WPFC_Exclude_Admin_Cookie
    RewriteCond %{HTTP_HOST} ^www.mywebsite.it
    RewriteCond %{HTTP_USER_AGENT} !(facebookexternalhit|WP_FASTEST_CACHE_CSS_VALIDATOR|Twitterbot|LinkedInBot|WhatsApp|Mediatoolkitbot)
    RewriteCond %{HTTP_USER_AGENT} !(WP\sFastest\sCache\sPreload(\siPhone\sMobile)?\s*Bot)
    RewriteCond %{REQUEST_METHOD} !POST
    RewriteCond %{REQUEST_URI} !(\/){2}$
    RewriteCond %{REQUEST_URI} \/$
    RewriteCond %{QUERY_STRING} !.+
    RewriteCond %{HTTP:Cookie} !comment_author_
    RewriteCond %{HTTP:Cookie} !safirmobilswitcher=masaustu
    RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC]
    RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/%{HTTP_HOST}/all/$1/index.html -f [or]
    RewriteCond /home/aw46l23c/reggia/wp-content/cache/%{HTTP_HOST}/all/$1/index.html -f
    RewriteRule ^(.*) "/wp-content/cache/%{HTTP_HOST}/all/$1/index.html" [L]
##### mobile #####
</IfModule>
<FilesMatch "index\.(html|htm)$">
    AddDefaultCharset UTF-8
    <ifModule mod_headers.c>
        FileETag None
        Header unset ETag
        Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
        Header set Pragma "no-cache"
        Header set Expires "Mon, 29 Oct 1923 20:30:00 GMT"
    </ifModule>
</FilesMatch>
# END WpFastestCache
# BEGIN GzipWpFastestCache
<IfModule mod_deflate.c>
    AddType x-font/woff .woff
    AddType x-font/ttf .ttf
    AddOutputFilterByType DEFLATE image/svg+xml
    AddOutputFilterByType DEFLATE text/plain
    AddOutputFilterByType DEFLATE text/html
    AddOutputFilterByType DEFLATE text/xml
    AddOutputFilterByType DEFLATE text/css
    AddOutputFilterByType DEFLATE text/javascript
    AddOutputFilterByType DEFLATE application/xml
    AddOutputFilterByType DEFLATE application/xhtml+xml
    AddOutputFilterByType DEFLATE application/rss+xml
    AddOutputFilterByType DEFLATE application/javascript
    AddOutputFilterByType DEFLATE application/x-javascript
    AddOutputFilterByType DEFLATE application/x-font-ttf
    AddOutputFilterByType DEFLATE x-font/ttf
    AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
    AddOutputFilterByType DEFLATE font/opentype font/ttf font/eot font/otf
</IfModule>
# END GzipWpFastestCache
# BEGIN LBCWpFastestCache
<FilesMatch "\.(webm|ogg|mp4|ico|pdf|flv|avif|jpg|jpeg|png|gif|webp|js|css|swf|x-html|css|xml|js|woff|woff2|otf|ttf|svg|eot)(\.gz)?$">
    <IfModule mod_expires.c>
        AddType application/font-woff2 .woff2
        AddType application/x-font-opentype .otf
        ExpiresActive On
        ExpiresDefault A0
        ExpiresByType video/webm A10368000
        ExpiresByType video/ogg A10368000
        ExpiresByType video/mp4 A10368000
        ExpiresByType image/avif A10368000
        ExpiresByType image/webp A10368000
        ExpiresByType image/gif A10368000
        ExpiresByType image/png A10368000
        ExpiresByType image/jpg A10368000
        ExpiresByType image/jpeg A10368000
        ExpiresByType image/ico A10368000
        ExpiresByType image/svg+xml A10368000
        ExpiresByType text/css A10368000
        ExpiresByType text/javascript A10368000
        ExpiresByType application/javascript A10368000
        ExpiresByType application/x-javascript A10368000
        ExpiresByType application/font-woff2 A10368000
        ExpiresByType application/x-font-opentype A10368000
        ExpiresByType application/x-font-truetype A10368000
    </IfModule>
    <IfModule mod_headers.c>
        Header set Expires "max-age=A10368000, public"
        Header unset ETag
        Header set Connection keep-alive
        FileETag None
    </IfModule>
</FilesMatch>
# END LBCWpFastestCache
# BEGIN WEBPWpFastestCache
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP_ACCEPT} image/webp
    RewriteCond %{REQUEST_URI} \.(jpe?g|png)
    RewriteCond %{DOCUMENT_ROOT}/$1.webp -f [or]
    RewriteCond /home/aw46l23c/reggia/$1.webp -f
    RewriteRule ^(.*) "/$1.webp" [L]
</IfModule>
<IfModule mod_headers.c>
    Header append Vary Accept env=REDIRECT_accept
</IfModule>
AddType image/webp .webp
# END WEBPWpFastestCache

# BEGIN WordPress
# Le direttive (linee) tra `BEGIN WordPress` e `END WordPress` sono
# generate dinamicamente, e dovrebbero essere modificate solo tramite i filtri di WordPress.
# Ogni modifica alle direttive tra questi marcatori verrà sovrascritta.
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
</IfModule>
# END WordPress
# FORZA USO HTPPS
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

########## BLOCCO USER AGENTS##########
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} DotBot [NC]
RewriteRule .* - [F,L]
RewriteCond %{HTTP_USER_AGENT} oBot [NC]
RewriteRule .* - [F,L]
RewriteCond %{HTTP_USER_AGENT} proximic [NC]
RewriteRule .* - [F,L]
RewriteCond %{HTTP_USER_AGENT} GrapeshotCrawler [NC]
RewriteRule .* - [F,L]
RewriteCond %{HTTP_USER_AGENT} SeznamBot [NC]
RewriteRule .* - [F,L]
RewriteCond %{HTTP_USER_AGENT} bingbot [NC]
RewriteRule .* - [F,L]
RewriteCond %{HTTP_USER_AGENT} SemrushBot [NC]
RewriteRule .* - [F,L]
########## FINE BLOCCO USER AGENTS##########

# URL REDIRECT LINK ITALIANO
Redirect 301 /visita-virtuale/piazza-carlo-iii/ https://www.mywebsite.it/visita-virtuale/
Redirect 301 /visita-virtuale/scalone-onore/ https://www.mywebsite.it/visita-virtuale/
Redirect 301 /visita-virtuale/parterre/ https://www.mywebsite.it/visita-virtuale/
Redirect 301 /visita-virtuale/fontane/ https://www.mywebsite.it/visita-virtuale/
Redirect 301 /visita-virtuale/giardino-inglese/ https://www.mywebsite.it/visita-virtuale/
Redirect 301 /visita-virtuale/acquedotto-carolino/ https://www.mywebsite.it/visita-virtuale/
Redirect 301 /visita-virtuale/belvedere-di-san-leucio/ https://www.mywebsite.it/visita-virtuale/
Redirect 301 /visita-virtuale/terrae-motus/ https://www.mywebsite.it/visita-virtuale/
Redirect 301 /visita-virtuale/sala-del-consiglio/ https://www.mywebsite.it/visita-virtuale/
Redirect 301 /visita-virtuale/bagno-maria-carolina/ https://www.mywebsite.it/visita-virtuale/
Redirect 301 /visita-virtuale/sala-del-trono/ https://www.mywebsite.it/visita-virtuale/
Redirect 301 /visita-virtuale/teatro-di-corte/ https://www.mywebsite.it/visita-virtuale/
Redirect 301 /visita-virtuale/biblioteca-palatina/ https://www.mywebsite.it/visita-virtuale/
Redirect 301 /visita-virtuale/sala-di-astrea/ https://www.mywebsite.it/visita-virtuale/
Redirect 301 /visita-virtuale/cappella-palatina/ https://www.mywebsite.it/visita-virtuale/
Redirect 301 /visita-virtuale/pinacoteca/ https://www.mywebsite.it/visita-virtuale/
Redirect 301 /visita-virtuale/sala-della-primavera/ https://www.mywebsite.it/visita-virtuale/
Redirect 301 /visita-virtuale/sala-di-alessandro/ https://www.mywebsite.it/visita-virtuale/
Redirect 301 /log-in/ https://www.mywebsite.it

# URL REDIRECT LINK INGLESE
Redirect 301 /handbook/decorative-arts/(.*) /art/decorative-arts/$1
Redirect 301 "/en/en-home " https://www.mywebsite.it/en/
Redirect 301 "/en/page/2 " https://www.mywebsite.it/en/
Redirect 301 "/en/page/3 " https://www.mywebsite.it/en/
Redirect 301 "/en/page/6 " https://www.mywebsite.it/en/
Redirect 301 "/en/virtual-visit " https://www.mywebsite.it/virtual-tour/
Redirect 301 /en/visit /infos/
Redirect 301 /en/art-history/luigi-vanvitelli /art/luigi-vanvitelli/
Redirect 301 /infos/guided-tour/?nonamp=1 /infos/guided-tour
Redirect 301 /palace/historical-apartments /palace/halls/
Redirect 301 /palace/route-b-picture-gallery https://www.mywebsite.it/collections/picture-gallery/
Redirect 301 /palace/terrae-motus-collection/ https://www.mywebsite.it/collections/terrae-motus-collection/
Redirect 301 /garden/history /garden/history-park/
Redirect 301 /palace/history /palace/palace-history/
Redirect 301 /kingdom-two-sicilies /history/kingdom-two-sicilies/
Redirect 301 /san-leucio /garden/san-leucio/
Redirect 301 /virtual-tour/square/ https://www.mywebsite.it/virtual-tour/
Redirect 301 /virtual-tour/grand-staircase/ https://www.mywebsite.it/virtual-tour/
Redirect 301 /virtual-tour/parterre/ https://www.mywebsite.it/virtual-tour/
Redirect 301 /virtual-tour/fountains/ https://www.mywebsite.it/virtual-tour/
Redirect 301 /virtual-tour/english-garden/ https://www.mywebsite.it/virtual-tour/
Redirect 301 /virtual-tour/carolino-acqueduct/ https://www.mywebsite.it/virtual-tour/
Redirect 301 /virtual-tour/belvedere-san-leucio/ https://www.mywebsite.it/virtual-tour/
Redirect 301 /virtual-tour/terrae-motus/ https://www.mywebsite.it/virtual-tour/
Redirect 301 /terrae-motus/ https://www.mywebsite.it/virtual-tour/
Redirect 301 /virtual-tour/bathroom-maria-carolina/ https://www.mywebsite.it/virtual-tour/
Redirect 301 /virtual-tour/council-room/ https://www.mywebsite.it/virtual-tour/
Redirect 301 /virtual-tour/court-theatre/ https://www.mywebsite.it/virtual-tour/
Redirect 301 /virtual-tour/hall-alexander/ https://www.mywebsite.it/virtual-tour/
Redirect 301 /virtual-tour/hall-astrea/ https://www.mywebsite.it/virtual-tour/
Redirect 301 /virtual-tour/hall-spring/ https://www.mywebsite.it/virtual-tour/
Redirect 301 /virtual-tour/palatine-chapel/ https://www.mywebsite.it/virtual-tour/
Redirect 301 /virtual-tour/palatine-library/ https://www.mywebsite.it/virtual-tour/
Redirect 301 /virtual-tour/picture-gallery/ https://www.mywebsite.it/virtual-tour/
Redirect 301 /virtual-tour/throne-room/ https://www.mywebsite.it/virtual-tour/



# REDIRECT IMMAGINI
Redirect 301 /wp-content/uploads/cannocchiale-my-website.jpg https://www.mywebsite.it/wp-content/uploads/my-website-effetto-cannocchiale.webp
Redirect 301 /wp-content/uploads/1-fountain-delfini-caserta-palace1.jpg https://www.mywebsite.it/wp-content/uploads/my-website-panorama-con-parco-e-via-d-acqua-visto-dalla-fontana-dei-delfini.webp
Redirect 301 /wp-content/uploads/2-fountain-delfini-caserta-palace1.jpg https://www.mywebsite.it/wp-content/uploads/parco-della-my-website-fontana-fontane-dei-delfini-sculture.webp
Redirect 301 /wp-content/uploads/4538-fountain-eolo-caserta-palace-b.jpg https://www.mywebsite.it/wp-content/uploads/parco-della-my-website-fontana-di-eolo-dei-venti-foto-2.webp
Redirect 301 /wp-content/uploads/my-website-fontana-margherita.jpg https://www.mywebsite.it/arte/progetti-virtuali/my-website-parco-reale-parterre-fontana-margherita/
Redirect 301 /wp-content/uploads/firma-vanvitelli.jpg https://www.mywebsite.it/arte/luigi-vanvitelli/firma-di-luigi-vanvitelli/
Redirect 301 /wp-content/uploads/caserta-palace-dream-2.jpg https://www.mywebsite.it/wp-content/uploads/my-website-palace-dream-film-kasia-smutniak-mastandrea-dreyfuss.webp
Redirect 301 /wp-content/uploads/sala-trono-my-website-lampadari-fotomontaggio-confronto.jpg https://www.mywebsite.it/wp-content/uploads/my-website-fotomontaggi-ricostruzione-virtuale-lampadari-sala-del-trono-prima-e-dopo.webp
Redirect 301 /wp-content/uploads/sfondo-my-website-sala-della-primavera-1.jpg https://www.mywebsite.it/wp-content/uploads/my-website-sala-della-primavera-1.webp
Redirect 301 /wp-content/uploads/sala-primavera-1.jpg https://www.mywebsite.it/wp-content/uploads/my-website-sala-della-primavera-1.webp
Redirect 301 /wp-content/uploads/sala-primavera.jpg https://www.mywebsite.it/wp-content/uploads/my-website-sala-della-primavera-1.webp
Redirect 301 /wp-content/uploads/nicola-sangiovanni-giostra-aerea.jpg https://www.mywebsite.it/wp-content/uploads/my-website-giochi-divertimenti-borbone-la-giostra-aerea-–-Nicola-Sangiovanni-1830.jpg
Redirect 301 /wp-content/uploads/gioco-pallone-caserta.jpg https://www.mywebsite.it/wp-content/uploads/my-website-giochi-divertimenti-borbone-gioco-di-giovani-uomini-con-il-pallone.webp
Redirect 301 /wp-content/uploads/borbone-elisabetta-farnese.jpg https://www.mywebsite.it/wp-content/uploads/my-website-ritratto-di-elisabetta-farnese.webp
Redirect 301 /wp-content/uploads/carlo-iii-ercole-farnese.jpg https://www.mywebsite.it/wp-content/uploads/carlo-di-borbone-museo-archeologico-nazionale-di-napoli-ercole-farnese.webp
Redirect 301 /wp-content/uploads/carlo-iii-capodimonte-tiziano-danae.jpg https://www.mywebsite.it/wp-content/uploads/carlo-di-borbone-museo-di-capodimonte-danae-di-tiziano-vecellio.webp
Redirect 301 /wp-content/uploads/carrozza-ferdinando-ii-2.jpg https://www.mywebsite.it/wp-content/uploads/carrozza-di-re-ferdinando-ii-2.webp
Redirect 301 /wp-content/uploads/carrozza-ferdinando-ii.jpg https://www.mywebsite.it/wp-content/uploads/carrozza-di-re-ferdinando-ii-1.webp
Redirect 301 /wp-content/uploads/caserta-capodimonte-portantina-948.jpg https://www.mywebsite.it/wp-content/uploads/portantine-napoletane-portantina-di-re-carlo-ii-di-borbone-museo-di-capodimonte.webp
Redirect 301 /wp-content/uploads/caserta-portantina-948.jpg https://www.mywebsite.it/wp-content/uploads/my-website-portantina-di-papa-pio-ix-portantine-napoletane.webp
Redirect 301 /collections/books/declaration-of-the-drawings-of-the-royal-palace-of-caserta/ https://www.mywebsite.it/papers-and-books/declaration-of-the-drawings-of-the-royal-palace-of-caserta/
Redirect 301 /wp-content/uploads/borbone-carlo-iii-capodimonte.jpg https://www.mywebsite.it/wp-content/uploads/my-website-carlo-iii-di-borbone-ritratto-da-capodimonte.webp


# URL REWRITE LINK ITALIANO
Options -MultiViews
RewriteEngine on
ErrorDocument 404 /404-error/
RedirectMatch 301 /it/(.*) /$1

RedirectMatch 301 /storia-reggia-caserta/(.*) /storia/$1
RewriteRule ^visita-virtuale/(.*) https://www.mywebsite.it/visita-virtuale/$1 [R=301,L]


# URL REWRITE LINK INGLESE
RewriteEngine on
RedirectMatch 301 /en/palace/(.*) /palace/$1
Redirect 301 /en/handbook/decorative-arts/(.*) /art/decorative-arts/$1
RedirectMatch 301 /en/virtual-visit/(.*) /virtual-tour/$1
RedirectMatch 301 /en/art-history/(.*) /art/$1
RedirectMatch 301 /en/handbook/(.*) /art/$1
RedirectMatch 301 /handbook/(.*) /art/$1
RedirectMatch 301 /en/garden/(.*) /garden/$1
RedirectMatch 301 /en/history/(.*) /history/$1
RedirectMatch 301 /en/papers-and-books/(.*) /papers-and-books/$1
RedirectMatch 301 /en/art/(.*) /art/$1
RedirectMatch 301 /en/collections/(.*) /collections/$1
RedirectMatch 301 /en/virtual-tour/(.*) /virtual-tour/$1
RedirectMatch 301 /en/videos/(.*) /videos/$1
RedirectMatch 301 /en/infos/(.*) /infos/$1
RedirectMatch 301 /en/contact-2/(.*) /contact-2/$1

<IfModule mod_deflate.c>
# Remove browser bugs (only needed for ancient browsers)
    BrowserMatch ^Mozilla/4 gzip-only-text/html
    BrowserMatch ^Mozilla/4\.0[678] no-gzip
    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
    Header append Vary User-Agent
</IfModule>
<Files 403.shtml>
    order allow,deny
    allow from all
</Files>

# BEGIN ShortPixelWebp
# Le direttive (linee) tra `BEGIN ShortPixelWebp` e `END ShortPixelWebp` sono
# generate dinamicamente, e dovrebbero essere modificate solo tramite i filtri di WordPress.
# Ogni modifica alle direttive tra questi marcatori verrà sovrascritta.

# END ShortPixelWebp

OTHER HTACCESS

**/PUBLIC_HTML/WP-CONTENT/.HTACCESS**

# BEGIN ShortPixelWebp
# Le direttive (linee) tra `BEGIN ShortPixelWebp` e `END ShortPixelWebp` sono
# generate dinamicamente, e dovrebbero essere modificate solo tramite i filtri di WordPress.
# Ogni modifica alle direttive tra questi marcatori verrà sovrascritta.

# END ShortPixelWebp


----------


**/PUBLIC_HTML/WP-CONTENT/PLUGINS/P3-PROFILER/LANGUAGES/**
Deny from all


----------


**/PUBLIC_HTML/WP-CONTENT/PLUGINS/P3-PROFILER/CLASSES/**
Deny from all


----------


**/PUBLIC_HTML/WP-CONTENT/PLUGINS/P3-PROFILER/EXCEPTIONS/**
Deny from all


----------


**/PUBLIC_HTML/WP-CONTENT/PLUGINS/P3-PROFILER/TEMPLATES/**
Deny from all


----------


**/PUBLIC_HTML/WP-CONTENT/PLUGINS/SHORTPIXEL-IMAGE-OPTIMISER/RES/IMG/**
<IfModule mod_rewrite.c>
  RewriteEngine On

  ##### TRY FIRST the file appended with .webp (ex. test.jpg.webp) #####
  # Does browser explicitly support webp?
  RewriteCond %{HTTP_USER_AGENT} Chrome [OR]
  # OR Is request from Page Speed
  RewriteCond %{HTTP_USER_AGENT} "Google Page Speed Insights" [OR]
  # OR does this browser explicitly support webp
  RewriteCond %{HTTP_ACCEPT} image/webp
  # AND is the request a jpg, png or gif?
  RewriteCond %{REQUEST_URI} ^(.+)\.(?:jpe?g|png|gif)$
  # AND does a .ext.webp image exist?
  RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI}.webp -f
  # THEN send the webp image and set the env var webp
  RewriteRule ^(.+)$ $1.webp [NC,T=image/webp,E=webp,L]

  ##### IF NOT, try the file with replaced extension (test.webp) #####
  RewriteCond %{HTTP_USER_AGENT} Chrome [OR]
  RewriteCond %{HTTP_USER_AGENT} "Google Page Speed Insights" [OR]
  RewriteCond %{HTTP_ACCEPT} image/webp
  # AND is the request a jpg, png or gif? (also grab the basepath %1 to match in the next rule)
  RewriteCond %{REQUEST_URI} ^(.+)\.(?:jpe?g|png|gif)$
  # AND does a .ext.webp image exist?
  RewriteCond %{DOCUMENT_ROOT}/%1.webp -f
  # THEN send the webp image and set the env var webp
  RewriteRule (.+)\.(?:jpe?g|png|gif)$ $1.webp [NC,T=image/webp,E=webp,L]

</IfModule>
<IfModule mod_headers.c>
  # If REDIRECT_webp env var exists, append Accept to the Vary header
  Header append Vary Accept env=REDIRECT_webp
</IfModule>

<IfModule mod_mime.c>
  AddType image/webp .webp
</IfModule>


----------


/PUBLIC_HTML/WP-CONTENT/UPLOADS/WPFORMS/
# BEGIN WPForms
# Le direttive (linee) tra `BEGIN WPForms` e `END WPForms` sono
# generate dinamicamente, e dovrebbero essere modificate solo tramite i filtri di WordPress.
# Ogni modifica alle direttive tra questi marcatori verrà sovrascritta.
# Disable PHP and Python scripts parsing.
<Files *>
  SetHandler none
  SetHandler default-handler
  RemoveHandler .cgi .php .php3 .php4 .php5 .phtml .pl .py .pyc .pyo
  RemoveType .cgi .php .php3 .php4 .php5 .phtml .pl .py .pyc .pyo
</Files>
<IfModule mod_php5.c>
  php_flag engine off
</IfModule>
<IfModule mod_php7.c>
  php_flag engine off
</IfModule>
<IfModule mod_php8.c>
  php_flag engine off
</IfModule>
<IfModule headers_module>
  Header set X-Robots-Tag "noindex"
</IfModule>
# END WPForms


----------


**/PUBLIC_HTML/WP-CONTENT/WFLOGS/**
<IfModule mod_authz_core.c>
    Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
    Order deny,allow
    Deny from all
</IfModule>


----------


**/PUBLIC_HTML/WP-CONTENT/UPLOADS/SHORTPIXELBACKUPS/**
Options -Indexes


----------


**/PUBLIC_HTML/WP-CONTENT/UPLOADS/SHORTPIXELBACKUPS/WP-CONTENT/**
Options -Indexes


----------


**/PUBLIC_HTML/WP-CONTENT/UPLOADS/WC-LOGS/**
deny from all


----------


**/PUBLIC_HTML/WP-CONTENT/UPLOADS/PROFILES/**
Deny from all


----------


**/PUBLIC_HTML/WP-CONTENT/UPLOADS/WPCF7_UPLOADS/**
Deny from all


----------


**/PUBLIC_HTML/WP-CONTENT/LOGS/WBCR_CLEARFY/**
deny from all


----------


**/PUBLIC_HTML/WP-CONTENT/LOGS/WBCR_IMAGE_OPTIMIZER/**
deny from all

Solution

  • You can use a rewrite rule like this:

    RewriteEngine on
    RewriteRule ^/?tag/.* - [G,L]
    
    • ^/?tag.* is any URL path that starts with "/tag/". The first slash is optional so that the rule works in both .htaccess and Apache conf files.
    • - is the target URL (no target in this case, because the rule just sets a status)
    • [G] means to to use the Gone (410) HTTP status
    • [L] means the Last rewrite rule so that other rules wouldn't conflict

    I put this rule at the top of my .htaccess file on my dev server and tested that it returns a 410 status for /tag/foo or my server: