所有子目录的 410 重定向
410 redirect for all the subdirectories
必须通过 htaccess 为 mywebsite.com/tag/ 文件夹中的所有子目录提供 410。我尝试了很多代码但没有任何效果
示例:
https://www.mywebsite.com/tag/piazza/feed/
https://www.mywebsite.com/tag/womans-rights/feed/
我已经从我的网站上删除了所有标签页面,我希望所有这些页面都收到 410 代码,因为我在 google 的搜索控制台中有大量未编入索引的错误。我已经尝试将 410 插件插入 wordpress,但它不起作用。我也为 htaccess 尝试了许多代码,但没有任何反应。
非常感谢。
主 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//index.html -f [or]
RewriteCond /home/aw46l23c/reggia/wp-content/cache/%{HTTP_HOST}/all//index.html -f
RewriteRule ^(.*) "/wp-content/cache/%{HTTP_HOST}/all//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//index.html -f [or]
RewriteCond /home/aw46l23c/reggia/wp-content/cache/%{HTTP_HOST}/all//index.html -f
RewriteRule ^(.*) "/wp-content/cache/%{HTTP_HOST}/all//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}/.webp -f [or]
RewriteCond /home/aw46l23c/reggia/.webp -f
RewriteRule ^(.*) "/.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/
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/(.*) /
RedirectMatch 301 /storia-reggia-caserta/(.*) /storia/
RewriteRule ^visita-virtuale/(.*) https://www.mywebsite.it/visita-virtuale/ [R=301,L]
# URL REWRITE LINK INGLESE
RewriteEngine on
RedirectMatch 301 /en/palace/(.*) /palace/
Redirect 301 /en/handbook/decorative-arts/(.*) /art/decorative-arts/
RedirectMatch 301 /en/virtual-visit/(.*) /virtual-tour/
RedirectMatch 301 /en/art-history/(.*) /art/
RedirectMatch 301 /en/handbook/(.*) /art/
RedirectMatch 301 /handbook/(.*) /art/
RedirectMatch 301 /en/garden/(.*) /garden/
RedirectMatch 301 /en/history/(.*) /history/
RedirectMatch 301 /en/papers-and-books/(.*) /papers-and-books/
RedirectMatch 301 /en/art/(.*) /art/
RedirectMatch 301 /en/collections/(.*) /collections/
RedirectMatch 301 /en/virtual-tour/(.*) /virtual-tour/
RedirectMatch 301 /en/videos/(.*) /videos/
RedirectMatch 301 /en/infos/(.*) /infos/
RedirectMatch 301 /en/contact-2/(.*) /contact-2/
<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
其他 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 ^(.+)$ .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)$ .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
您可以使用这样的重写规则:
RewriteEngine on
RewriteRule ^/?tag/.* - [G,L]
^/?tag.*
是任何以“/tag/”开头的 URL 路径。第一个斜杠是可选的,因此该规则适用于 .htaccess 和 Apache conf 文件。
-
是目标URL(本例中没有目标,因为规则只是设置了一个状态)
[G]
表示使用 Gone (410) HTTP 状态
[L]
表示最后重写规则,这样其他规则就不会冲突
我将此规则放在我的开发服务器上的 .htaccess 文件的顶部并测试它 returns /tag/foo
或我的服务器的 410 状态:
必须通过 htaccess 为 mywebsite.com/tag/ 文件夹中的所有子目录提供 410。我尝试了很多代码但没有任何效果
示例: https://www.mywebsite.com/tag/piazza/feed/ https://www.mywebsite.com/tag/womans-rights/feed/
我已经从我的网站上删除了所有标签页面,我希望所有这些页面都收到 410 代码,因为我在 google 的搜索控制台中有大量未编入索引的错误。我已经尝试将 410 插件插入 wordpress,但它不起作用。我也为 htaccess 尝试了许多代码,但没有任何反应。 非常感谢。
主 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//index.html -f [or]
RewriteCond /home/aw46l23c/reggia/wp-content/cache/%{HTTP_HOST}/all//index.html -f
RewriteRule ^(.*) "/wp-content/cache/%{HTTP_HOST}/all//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//index.html -f [or]
RewriteCond /home/aw46l23c/reggia/wp-content/cache/%{HTTP_HOST}/all//index.html -f
RewriteRule ^(.*) "/wp-content/cache/%{HTTP_HOST}/all//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}/.webp -f [or]
RewriteCond /home/aw46l23c/reggia/.webp -f
RewriteRule ^(.*) "/.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/
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/(.*) /
RedirectMatch 301 /storia-reggia-caserta/(.*) /storia/
RewriteRule ^visita-virtuale/(.*) https://www.mywebsite.it/visita-virtuale/ [R=301,L]
# URL REWRITE LINK INGLESE
RewriteEngine on
RedirectMatch 301 /en/palace/(.*) /palace/
Redirect 301 /en/handbook/decorative-arts/(.*) /art/decorative-arts/
RedirectMatch 301 /en/virtual-visit/(.*) /virtual-tour/
RedirectMatch 301 /en/art-history/(.*) /art/
RedirectMatch 301 /en/handbook/(.*) /art/
RedirectMatch 301 /handbook/(.*) /art/
RedirectMatch 301 /en/garden/(.*) /garden/
RedirectMatch 301 /en/history/(.*) /history/
RedirectMatch 301 /en/papers-and-books/(.*) /papers-and-books/
RedirectMatch 301 /en/art/(.*) /art/
RedirectMatch 301 /en/collections/(.*) /collections/
RedirectMatch 301 /en/virtual-tour/(.*) /virtual-tour/
RedirectMatch 301 /en/videos/(.*) /videos/
RedirectMatch 301 /en/infos/(.*) /infos/
RedirectMatch 301 /en/contact-2/(.*) /contact-2/
<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
其他 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 ^(.+)$ .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)$ .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
您可以使用这样的重写规则:
RewriteEngine on
RewriteRule ^/?tag/.* - [G,L]
^/?tag.*
是任何以“/tag/”开头的 URL 路径。第一个斜杠是可选的,因此该规则适用于 .htaccess 和 Apache conf 文件。-
是目标URL(本例中没有目标,因为规则只是设置了一个状态)[G]
表示使用 Gone (410) HTTP 状态[L]
表示最后重写规则,这样其他规则就不会冲突
我将此规则放在我的开发服务器上的 .htaccess 文件的顶部并测试它 returns /tag/foo
或我的服务器的 410 状态: