У меня, кажется, странная проблема, которая происходит только на одной машине, а не на другой, версия apache2 на этой версии 2.4.23 (не работает), а на рабочей у меня есть версия apache 2.4.10.
Фрагмент переписывания, который у меня есть, перенаправляет URL-адреса без расширений .html внутренне, если файл существует и выглядит следующим образом
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.*?)/?$ $1.html [L,QSA]
Я удаляю эту часть, циклы перенаправления прекращаются, но, очевидно, мои расширения без расширенийURL-адреса больше не перенаправляются.
Я развил это до этого, который, как я думал, наверняка остановит проблему перенаправления, но все еще работает постоянно
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteCond %{REQUEST_FILENAME} !\.html$
RewriteRule ^(.*?)/?(?!\.html/)$ $1.html [L,QSA]
Включение уровня журнала отладки на рассматриваемом сервере apache даеттонна строк, похожих на эту
[Wed May 30 11:49:25.669176 2018] [rewrite:trace3] [pid 4292] mod_rewrite.c(477): [client xx.xx.xxx.xxx:63613] xx.xx.xxx.xxx - - [domain.com/sid#7f30066c1328][rid#7f2fff7d5718/initial/redir#9] [perdir /domains/domain.com/public_html/] applying pattern '^(.*)$' to uri '2012/06/some-blog-post/privacy.html.html.html.html.html.html.html.html.html'
[Wed May 30 11:49:25.669200 2018] [rewrite:trace3] [pid 4292] mod_rewrite.c(477): [client xx.xx.xxx.xxx:63613] xx.xx.xxx.xxx - - [domain.com/sid#7f30066c1328][rid#7f2fff7d5718/initial/redir#9] [perdir /domains/domain.com/public_html/] add path info postfix: /domains/domain.com/public_html/2012/06/some-blog-post -> /domains/domain.com/public_html/2012/06/some-blog-post/privacy.html.html.html.html.html.html.html.html.html
[Wed May 30 11:49:25.669215 2018] [rewrite:trace3] [pid 4292] mod_rewrite.c(477): [client xx.xx.xxx.xxx:63613] xx.xx.xxx.xxx - - [domain.com/sid#7f30066c1328][rid#7f2fff7d5718/initial/redir#9] [perdir /domains/domain.com/public_html/] strip per-dir prefix: /domains/domain.com/public_html/2012/06/some-blog-post/privacy.html.html.html.html.html.html.html.html.html -> 2012/06/some-blog-post/privacy.html.html.html.html.html.html.html.html.html
Боюсь, я не очень хорошо разбираюсь в синтаксисе htaccess, поэтому, возможно, я упускаю что-то очевидное
Вот весь файл htaccess (извините, он немного длинный)
RedirectMatch 301 ^/quote/?$ /pricing
RedirectMatch 301 ^/order\.htm/?$ /order
RedirectMatch 301 ^/contact\.htm/?$ /contact
RedirectMatch 301 ^/coin-gallery\.htm/?$ /gallery
RedirectMatch 301 ^/gallery-html/?$ /gallery
RedirectMatch 301 ^/baseball-html/?$ /baseball-trading-pins
RedirectMatch 301 ^/softball-html/?$ /baseball-trading-pins
RedirectMatch 301 ^/volleyball-html/?$ /baseball-trading-pins
RedirectMatch 301 ^/basketball-html/?$ /baseball-trading-pins
RedirectMatch 301 ^/football-html/?$ /baseball-trading-pins
RedirectMatch 301 ^/soccer-html/?$ /baseball-trading-pins
RedirectMatch 301 ^/hockey-html/?$ /baseball-trading-pins
##blogs-500s
RedirectMatch 301 ^/tag.*$ /blog
RedirectMatch 301 ^/wp.*$ /blog
RedirectMatch 301 ^/category\/.*$ /blog
RedirectMatch 301 ^/[^a-zA-Z]+$ /blog
##pins
RedirectMatch 301 ^/sitemap-html/?$ /
RedirectMatch 301 ^/quote_lapelpins\.html/?$ /
RedirectMatch 301 ^/custom-html/?$ /custom-lapel-pin-styles
RedirectMatch 301 ^/softenamel-html/?$ /soft-enamel-pins
RedirectMatch 301 ^/cardstock-html/?$ /cardstock
RedirectMatch 301 ^/employee-html/?$ /employee-recognition-pins
RedirectMatch 301 ^/employee-recognition/?$ /employee-recognition-pins
RedirectMatch 301 ^/baseball-html/?$ /baseball-trading-pins
RedirectMatch 307 ^/softball-html/?$ /baseball-trading-pins
RedirectMatch 307 ^/volleyball-html/?$ /baseball-trading-pins
RedirectMatch 307 ^/basketball-html/?$ /baseball-trading-pins
RedirectMatch 307 ^/football-html/?$ /baseball-trading-pins
RedirectMatch 307 ^/usssaquote_tradingpins\.html/?$ /custom-usssa-trading-pins?lid=Ij2
RedirectMatch 307 ^/soccer-html/?$ /baseball-trading-pins
RedirectMatch 307 ^/hockey-html/?$ /baseball-trading-pins
RedirectMatch 307 ^/cloisonne-html/?$ /cloisonne-pins
RedirectMatch 301 ^/pin-pricing/?$ /pricing
RedirectMatch 301 ^/rush-pins-2/?$ /rush-pins
RedirectMatch 301 ^/baseball\.html/?$ /baseball-trading-pins
RedirectMatch 307 ^/softball\.html/?$ /baseball-trading-pins
RedirectMatch 307 ^/soccer\.html/?$ /baseball-trading-pins
RedirectMatch 307 ^/volleyball\.html/?$ /baseball-trading-pins
RedirectMatch 307 ^/basketball\.html/?$ /baseball-trading-pins
RedirectMatch 307 ^/football\.html/?$ /baseball-trading-pins
RedirectMatch 307 ^/hockey\.html/?$ /baseball-trading-pins
RedirectMatch 301 ^/contactus-html/?$ /contact
RedirectMatch 301 ^/aboutus-html/?$ /about-us
RedirectMatch 301 ^/aboutus\.html/?$ /about-us
RedirectMatch 301 ^/aboutus\.htm/?$ /about-us
RedirectMatch 301 ^/termsandconditions-html/?$ /terms
RedirectMatch 301 ^/termsandconditions\.html/?$ /terms
RedirectMatch 301 ^/privacy-htm/?$ /privacy
RedirectMatch 301 ^/presentation\.html/?$ /presentation-options
RedirectMatch 301 ^/presentation-html/?$ /presentation-options
RedirectMatch 301 ^/attachments\.html/?$ /attachments
RedirectMatch 301 ^/attachments-html/?$ /attachments
RedirectMatch 301 ^/platingchart\.html/?$ /plating
RedirectMatch 301 ^/platingchart-html/?$ /plating
RedirectMatch 301 ^/gemstones\.html/?$ /gemstones
RedirectMatch 301 ^/trading-pin-options/?$ /baseball-trading-pins
RedirectMatch 301 ^/trading-pin-gallery/?$ /gallery
RedirectMatch 301 ^/trading-pin-gallery-2/?$ /gallery
RedirectMatch 301 ^/trading-pin-gallery-3/?$ /gallery
RedirectMatch 301 ^/trading-pin-gallery-4/?$ /gallery
RedirectMatch 301 ^/artwork\.html/?$ /artwork
RedirectMatch 301 ^/artwork-html/?$ /artwork
RedirectMatch 301 ^/keychains-html/?$ /keychains
RedirectMatch 301 ^/challengecoins-html/?$ /custom-challenge-coins
RedirectMatch 301 ^/medallions-html/?$ /medals-medallions
RedirectMatch 301 ^/wristbands-html/?$ /custom-wristbands
RedirectMatch 301 ^/lanyards-html/?$ /lanyards
RedirectMatch 301 ^/quote_tradingpins\.html/?$ /custom-usssa-trading-pins?lid=Ij2
RedirectMatch 301 ^/usssa-pins/?$ /custom-usssa-trading-pins?lid=Ij2
RedirectMatch 301 ^/contactus\.html/?$ /contact
RedirectMatch 301 ^/fraternitysorority-html/?$ /fraternity-and-sorority-pins
##coins
RedirectMatch 301 ^/coin-bottle-openers\.htm/?$ /coin-bottle-openers
RedirectMatch 301 ^/coin-gallery\.htm/?$ /gallery
RedirectMatch 301 ^/coin-gallery.*$ /gallery
RedirectMatch 301 ^/coin-pricing\.htm/?$ /pricing
RedirectMatch 301 ^/create\.htm/?$ /create
RedirectMatch 301 ^/presentation.htm/?$ /coin-presentation-options
RedirectMatch 301 ^/history\.htm/?$ /challenge-coin-history
RedirectMatch 301 ^/faq\.htm/?$ /faq
RedirectMatch 301 ^/testimonials\.htm/?$ /testimonials
RedirectMatch 301 ^/quote/?$ /create
RedirectMatch 301 ^/quote/view(\.php)?$ /view
##patches
RedirectMatch 301 ^/pvc-patches/?$ /pvc
<Files "header.php">
Order Allow,Deny
Deny from all
</Files>
<Files "footer.php">
Order Allow,Deny
Deny from all
</Files>
<Files "config.php">
Order Allow,Deny
Deny from all
</Files>
<Files "version">
Order Allow,Deny
Deny from all
</Files>
<Files "superheader.php">
Order Allow,Deny
Deny from all
</Files>
Options -Indexes
ErrorDocument 404 /404.html
ErrorDocument 500 /505.html
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.*)$
RewriteRule ^(.*)$ https://%1/$1 [R=301,L,NC]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -l
RewriteRule .* - [L]
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteCond %{REQUEST_FILENAME} !\.php$
RewriteRule ^(.*?)/?$ $1.php [L,QSA]
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteCond %{REQUEST_FILENAME} !\.html$
RewriteRule ^(.*?)/?(?!\.html/)$ $1.html [L,QSA]
RewriteRule ^/?img/([A-Fa-f0-9]{64}).gif$ /scripts/trackemail.php?id=$1 [QSA,L]
РЕДАКТИРОВАТЬ 2
Ой!Я забыл URL, который должен был быть первым, что я перечислил, но путь в этом примере был бы
/ 2012/06 / some-blog-post / privacy
Это заголовки ответа apache2, когда этот URL загружен
HTTP/1.1 500 Internal Server Error
Date: Wed, 06 Jun 2018 14:54:45 GMT
Server: Apache
Content-Length: 666
Connection: close
Content-Type: text/html; charset=iso-8859-1
Я взял немного больше (тонну) журнала apache2 после включения отладочного LogLevel и поместил его здесьhttps://pastebin.com/pu5sUJnG, добавление LogLevel alert rewrite:trace3
в мой файл apache2.conf