简体   繁体   English

410重定向适用于index.html,但不适用于index.php

[英]410 redirect working for index.html but not for index.php

I have the following folder structure: 我具有以下文件夹结构:

~ $ ls -1a ./html/.htaccess ./html/brochure_en/
./html/.htaccess

./html/brochure_en/:
.
..
index.html
index.php

The content of the .htaccess file is: .htaccess文件的内容是:

~ $ cat ./html/.htaccess
Redirect 410 /brochure_en/index.php
Redirect 410 /brochure_en/index.html

The line for "index.html" works, but access to "index.php" still returns http status code 200. Is this something the webserver admin has to fix or do I have to change something in the .htaccess file? “ index.html”行有效,但访问“ index.php”仍返回http状态代码200。这是Web服务器管理员必须修复的问题还是必须更改.htaccess文件中的内容?

Thanks 谢谢

UPDATE: Below is the full .htaccess file. 更新:以下是完整的.htaccess文件。 I just replaced some strings, eg sed 's/mycompany/example/g' . 我只是替换了一些字符串,例如sed 's/mycompany/example/g' Below .htaccess is in the webroot folder. 在.htaccess下面是webroot文件夹中。 There are other .htaccess files. 还有其他的.htaccess文件。 But those don't affect the folder /brochure/ and its content, because they are in other folder, eg /de/ , /en/ . 但是它们不会影响文件夹/ brochure /及其内容,因为它们位于其他文件夹中,例如/ de // en /

Require all granted

AddDefaultCharset utf-8
AddType application/javascript .js
AddType application/json       .json
AddType font/woff              .woff
AddType font/woff2             .woff2
AddType image/gif              .gif
AddType image/jpeg             .jpg
AddType image/png              .png
AddType image/svg+xml          .svg
AddType image/x-icon           .ico
AddType text/css               .css
AddType text/html              .html
AddType text/plain             .txt
AddType text/xml               .xml
AddType video/mp4              .mp4
AddType video/webm             .webm

Header set Cache-Control "max-age=604800, public, no-transform"
Header always set X-Frame-Options DENY
Header always set X-Content-Type-Options nosniff
Header always set X-XSS-Protection "1; mode=block"
Header always set Referrer-Policy "strict-origin-when-cross-origin"
Header always set Content-Security-Policy "base-uri 'self'; default-src 'none'; form-action 'none'; frame-ancestors 'none';"
Header always set X-Content-Security-Policy "base-uri 'self'; default-src 'none'; form-action 'none'; frame-ancestors 'none';"
Header always set X-WebKit-CSP "base-uri 'self'; default-src 'none'; form-action 'none'; frame-ancestors 'none';"
Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" "expr=%{HTTPS} == 'on'"
Header always unset Public-Key-Pins
Header always unset Public-Key-Pins-Report-Only
Header always unset Cookie
Header always unset Set-Cookie
Options -ExecCGI -FollowSymlinks -Includes -Indexes

RewriteEngine On
RewriteBase /

RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{SERVER_NAME}/$1 [R=301,L]

RewriteCond %{SERVER_NAME} !^www\.example\.com$ [NC]
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]

RewriteRule ^(|/)\. - [F]
RewriteRule ~$ - [F]

RewriteCond %{REQUEST_URI} ^/$
RewriteCond %{HTTP:Accept-Language} ^de.*$ [NC]
RewriteRule ^(.*)$ https://www.example.com/de/ [R=302,L]

RewriteCond %{REQUEST_URI} ^/$
RewriteRule ^(.*)$ https://www.example.com/en/ [R=302,L]

RewriteCond %{QUERY_STRING} !^$
RewriteRule ^(.*)$ /$1? [R=301,L]

RewriteRule ^(.*)/index\.html$ $1/ [R=301,L]

RewriteCond %{REQUEST_URI} ^/de/(behandlungskonzept|kontakt-und-info|exampletherapie|produkte)/$ [NC]
RewriteRule ^(.*)$ https://www.example.com/de/ [R=301,L]

RewriteCond %{REQUEST_URI} ^/en/(contact-and-info|example-therapy|products|treatment-concept)/$ [NC]
RewriteRule ^(.*)$ https://www.example.com/en/ [R=301,L]

#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
#>> REDIRECT OBSOLETE URLS >>>
#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

#>> FALSE GOOGLE ENTRIES
RewriteCond %{REQUEST_URI} ^/35 [NC,OR]
RewriteCond %{REQUEST_URI} ^/45 [NC]
RewriteRule ^(.*)$ https://www.example.com/ [R=301,L]

RewriteCond %{REQUEST_URI} ^/brochure_de/docs/brochure_de\.pdf [NC,OR]
RewriteCond %{REQUEST_URI} ^/de/willkommen/14-german-de-ch-at/support/59-dokumentation [NC]
RewriteRule ^(.*)$ https://www.example.com/de/ [R=301,L]
#<< FALSE GOOGLE ENTRIES

RewriteCond %{REQUEST_URI} ^/de/allgemeine-geschaeftsbedingungen-und-kundeninformation [NC,OR]
RewriteCond %{REQUEST_URI} ^/de/entsorgung-von-altbatterien [NC,OR]
RewriteCond %{REQUEST_URI} ^/de/hinweis-zur-entsorgung-von-altbatterien [NC,OR]
RewriteCond %{REQUEST_URI} ^/de/rechtstexte [NC,OR]
RewriteCond %{REQUEST_URI} ^/de/anwendungsbereiche/gesetzliche-vorschriften [NC,OR]
RewriteCond %{REQUEST_URI} ^/de/geschaeftspartner/forschung [NC,OR]
RewriteCond %{REQUEST_URI} ^/de/geschaeftspartner/medizin [NC,OR]
RewriteCond %{REQUEST_URI} ^/de/geschaeftspartner/vertrieb [NC,OR]
RewriteCond %{REQUEST_URI} ^/de/sitemap [NC,OR]
RewriteCond %{REQUEST_URI} ^/de/support/software [NC,OR]
RewriteCond %{REQUEST_URI} ^/de/unternehmen/philosophie [NC,OR]
RewriteCond %{REQUEST_URI} ^/de/unternehmen/standort [NC]
RewriteRule ^(.*)$ https://www.example.com/de/ [R=301,L]

RewriteCond %{REQUEST_URI} ^/de/produkte/exampleyair-example [NC,OR]
RewriteCond %{REQUEST_URI} ^/de/produkte/example-example [NC,OR]
RewriteCond %{REQUEST_URI} ^/de/produkte/example-example [NC,OR]
RewriteCond %{REQUEST_URI} ^/de/produkte/example-example [NC,OR]
RewriteCond %{REQUEST_URI} ^/de/produkte/example-examplep [NC]
RewriteRule ^(.*)$ https://www.example.com/de/produkte/behandlungsgeraete/ [R=301,L]

RewriteCond %{REQUEST_URI} ^/de/anwendungsbereiche/exampletherapie [NC]
RewriteRule ^(.*)$ https://www.example.com/de/exampletherapie/example-und-example/ [R=301,L]

RewriteCond %{REQUEST_URI} ^/de/anwendungsbereiche/kontraindikation [NC,OR]
RewriteCond %{REQUEST_URI} ^/de/anwendungsbereiche/offene-und-geschlossene-systeme [NC]
RewriteRule ^(.*)$ https://www.example.com/de/exampletherapie/kontraindikation/ [R=301,L]

RewriteCond %{REQUEST_URI} ^/de/anwendungsbereiche/zahnmedizin [NC]
RewriteRule ^(.*)$ https://www.example.com/de/exampletherapie/indikation/ [R=301,L]

RewriteCond %{REQUEST_URI} ^/de/unternehmen/kontakt [NC]
RewriteRule ^(.*)$ https://www.example.com/de/kontakt-und-info/kontaktformular/ [R=301,L]

RewriteCond %{REQUEST_URI} ^/de/support/medien [NC]
RewriteRule ^(.*)$ https://www.example.com/de/kontakt-und-info/produktvideos/ [R=301,L]

RewriteCond %{REQUEST_URI} ^/de/impressum [NC]
RewriteRule ^(.*)$ https://www.example.com/de/kontakt-und-info/impressum/ [R=301,L]

RewriteCond %{REQUEST_URI} ^/de/datenschutzerklaerung [NC]
RewriteRule ^(.*)$ https://www.example.com/de/kontakt-und-info/datenschutzerklaerung/ [R=301,L]

RewriteCond %{REQUEST_URI} ^/en/application-area/statutory-provisions [NC,OR]
RewriteCond %{REQUEST_URI} ^/en/business-partner/medicine [NC,OR]
RewriteCond %{REQUEST_URI} ^/en/business-partner/distribution [NC,OR]
RewriteCond %{REQUEST_URI} ^/en/business-partner/research [NC,OR]
RewriteCond %{REQUEST_URI} ^/en/sitemap [NC,OR]
RewriteCond %{REQUEST_URI} ^/en/company/location [NC,OR]
RewriteCond %{REQUEST_URI} ^/en/company/philosophy [NC,OR]
RewriteCond %{REQUEST_URI} ^/en/support/software [NC]
RewriteRule ^(.*)$ https://www.example.com/en/ [R=301,L]

RewriteCond %{REQUEST_URI} ^/en/products/exampleyair-example [NC,OR]
RewriteCond %{REQUEST_URI} ^/en/products/example-example [NC,OR]
RewriteCond %{REQUEST_URI} ^/en/products/example-example [NC,OR]
RewriteCond %{REQUEST_URI} ^/en/products/example-example [NC,OR]
RewriteCond %{REQUEST_URI} ^/en/products/example-examplep [NC]
RewriteRule ^(.*)$ https://www.example.com/en/products/treatment-devices/ [R=301,L]

RewriteCond %{REQUEST_URI} ^/en/application-area/example-therapy [NC]
RewriteRule ^(.*)$ https://www.example.com/en/example-therapy/example-and-examplee/ [R=301,L]

RewriteCond %{REQUEST_URI} ^/en/application-area/contraindication [NC,OR]
RewriteCond %{REQUEST_URI} ^/en/application-area/open-and-closed-systems [NC]
RewriteRule ^(.*)$ https://www.example.com/en/example-therapy/contraindication/ [R=301,L]

RewriteCond %{REQUEST_URI} ^/en/application-area/dentistry [NC]
RewriteRule ^(.*)$ https://www.example.com/en/example-therapy/indication/ [R=301,L]

RewriteCond %{REQUEST_URI} ^/en/company/contact [NC]
RewriteRule ^(.*)$ https://www.example.com/en/contact-and-info/contact-form/ [R=301,L]

RewriteCond %{REQUEST_URI} ^/en/support/media [NC]
RewriteRule ^(.*)$ https://www.example.com/en/contact-and-info/product-videos/ [R=301,L]

RewriteCond %{REQUEST_URI} ^/en/company-information [NC]
RewriteRule ^(.*)$ https://www.example.com/en/contact-and-info/legal-notice/ [R=301,L]
#<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
#<< REDIRECT OBSOLETE URLS <<<
#<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

#<<<<<<<<<<<<<<<<<<<<<<<
#<< DELETE BAD LINKS <<<
#<<<<<<<<<<<<<<<<<<<<<<<
Redirect 410 /brochure_de
Redirect 410 /brochure_en
Redirect 410 /de/probandenstudie.htm
Redirect 410 /en/firma.htm
Redirect 410 /en/probandenstudie.htm
Redirect 410 /en/company/events
Redirect 410 /en/examplec.htm
Redirect 410 /de/sonden.htm
Redirect 410 /de/examplea.htm
Redirect 410 /en/orthopaedie.htm
Redirect 410 /56
Redirect 410 /hinweis-zur-entsorgung-von-altbatterien
Redirect 410 /de/ansprechspersonen.htm
Redirect 410 /popup/fallbeispielreplantation.htm
Redirect 410 /en/exampletherapie.htm
Redirect 410 /de/fakten.htm
Redirect 410 /en/index.htm
Redirect 410 /de/examplec.htm
Redirect 410 /en/aktuell.htm
Redirect 410 /en/kaninchenstudie.htm
Redirect 410 /de/kaninchenstudie.htm
Redirect 410 /de/aktuell.htm
Redirect 410 /de/orthexample.htm
Redirect 410 /en/orthexample.htm
Redirect 410 /popup/exampleinderzahnmedizin.htm
Redirect 410 /popup/fallbeispielparodontitis.htm
Redirect 410 /de/geschaeftspartner/zahnmedizin
Redirect 410 /50 
Redirect 410 /de/firma.htm
Redirect 410 /de/tooths.htm
Redirect 410 /en/sonden.htm
Redirect 410 /en/fakten.htm
Redirect 410 /en/tooths.htm
Redirect 410 /en/examplea.htm
Redirect 410 /en/exampleb.htm
Redirect 410 /de/exampleb.htm
Redirect 410 /de/orthopaedie.htm
Redirect 410 /en/plagiate.htm
Redirect 410 /fra/speziellpatienten.htm
Redirect 410 /page/ 
Redirect 410 /de/index.htm
Redirect 410 /videos/sitemap.xml
Redirect 410 /anwendungsbereiche/kontraindikation
Redirect 410 /files/patienteninfo.pdf
#>>>>>>>>>>>>>>>>>>>>>>>
#>> DELETE BAD LINKS >>>
#>>>>>>>>>>>>>>>>>>>>>>>

#>>>>>>>>>>>>>>>>>>>>>>>>>
#>> STATIC COMPRESSION >>>
#>>>>>>>>>>>>>>>>>>>>>>>>>

# Disable dynamic compression
RewriteRule ^(.*)$ $1 [NS,E=no-gzip:1,E=dont-vary:1]

AddEncoding br .cssbr .gifbr .htmlbr .icobr .jpgbr .jsbr .jsonbr .mp4br .pngbr .svgbr .txtbr .webmbr .woffbr .woff2br .xmlbr
AddType application/javascript .jsbr
AddType application/json       .jsonbr
AddType font/woff              .woffbr
AddType font/woff2             .woff2br
AddType image/gif              .gifbr
AddType image/jpeg             .jpgbr
AddType image/png              .pngbr
AddType image/svg+xml          .svgbr
AddType image/x-icon           .icobr
AddType text/css               .cssbr
AddType text/html              .htmlbr
AddType text/plain             .txtbr
AddType text/xml               .xmlbr
AddType video/mp4              .mp4br
AddType video/webm             .webmbr

AddEncoding gzip .cssgz .gifgz .htmlgz .icogz .jpggz .jsgz .jsongz .mp4gz .pnggz .svggz .txtgz .webmgz .woffgz .woff2gz .xmlgz
AddType application/javascript .jsgz
AddType application/json       .jsongz
AddType font/woff              .woffgz
AddType font/woff2             .woff2gz
AddType image/gif              .gifgz
AddType image/jpeg             .jpggz
AddType image/png              .pnggz
AddType image/svg+xml          .svggz
AddType image/x-icon           .icogz
AddType text/css               .cssgz
AddType text/html              .htmlgz
AddType text/plain             .txtgz
AddType text/xml               .xmlgz
AddType video/mp4              .mp4gz
AddType video/webm             .webmgz

RewriteCond %{HTTP:Accept-Encoding} br
RewriteCond %{REQUEST_FILENAME}br -f
RewriteRule ^(.+)\.(css|gif|html|ico|jpg|js|json|mp4|png|svg|txt|webm|woff|woff2|xml)$ $1.$2br [L]

RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteCond %{REQUEST_FILENAME}gz -f
RewriteRule ^(.+)\.(css|gif|html|ico|jpg|js|json|mp4|png|svg|txt|webm|woff|woff2|xml)$ $1.$2gz [L]
#<<<<<<<<<<<<<<<<<<<<<<<<<
#<< STATIC COMPRESSION <<<
#<<<<<<<<<<<<<<<<<<<<<<<<<

我不知道该怎么做,但是在我联系了网络托管服务商之后,问题已经解决了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM