我htaccess的重定向到自定義錯誤頁頁面加載時間的ErrorDocument增加
如:
ErrorDocument 400 /ex/main/error.php?e=400
ErrorDocument 401 /ex/main/error.php?e=401
ErrorDocument 403 /ex/main/error.php?e=403
我注意到,當我訪問一個頁面內損壞的鏈接的頁面需要很長的時間加載。
169請求| 562 KB被傳| 1.2分鐘(負載:1.2分鐘,DOMContentLoaded:2.31 S)
如果我的ErrorDocument禁用所有行中的htaccess
169個請求| 150 KB被傳| 3.46 s(load:3.12 s,DOMContentLoaded:2.88 s)
問題,爲什麼加載需要這麼長時間?我懷疑這是通過每個斷開的鏈接error.php?
如果是這種情況,有沒有辦法修改.htacess忽略內部鏈接,只有在加載時檢查初始頁面,或者沒有辦法做到這一點?
編輯:
這是一個PHP頁面mypage.php調用一個TPL(mypage.tpl),所以在本質上的瀏覽器,這應該是一個HTML。
在Chrome中我可以看到每個斷開的鏈接進展非常緩慢時ErrorDocument的是,當我註釋掉他們去真快
GET http://127.0.0.1/ex/main/upload/221/ 403 (Forbidden) mypage.php:1972
GET http://127.0.0.1/ex/main/upload/194/d76fca99d30206e23630543f636246e7.jpg 404 (Not Found) mypage.php:2004
GET http://127.0.0.1/ex/main/upload/187/b9187d74b1a622868610696c89b429c1.png 404 (Not Found) mypage.php:2016
GET http://127.0.0.1/ex/main/upload/186/d39bbfdc9045bfd0428d1a98ad9138e6.jpg 404 (Not Found) mypage.php:2028
GET http://127.0.0.1/ex/main/upload/185/7d9e6d8d6fd631cef897c8b0e455d1b3.jpg 404 (Not Found) mypage.php:2040
GET http://127.0.0.1/ex/main/upload/184/77b778a4551434ab4ebe10efc62290ee.jpg 404 (Not Found) mypage.php:2052
GET http://127.0.0.1/ex/main/upload/183/ 404 (Not Found) mypage.php:2072
GET http://127.0.0.1/ex/main/upload/182/719efc3b142ac927e9a19de7eed865d9.jpg 404 (Not Found) mypage.php:2084
GET http://127.0.0.1/ex/main/upload/181/0761ee3949228e14f667e4ecd75bb696.jpg 404 (Not Found) mypage.php:2096
GET http://127.0.0.1/ex/main/upload/180/ 404 (Not Found) mypage.php:2108
GET http://127.0.0.1/ex/main/upload/179/77e16dcc3419dc00342a2df1d71a565a.jpg 404 (Not Found) mypage.php:2120
GET http://127.0.0.1/ex/main/upload/177/cd3c32ad9392f61d0cadda7c8dccfefa.jpg 404 (Not Found) mypage.php:2132
GET http://127.0.0.1/ex/main/upload/172/d07c37c0413f85a6f4fbe5c852ae8a5e.jpg 404 (Not Found) mypage.php:2152
GET http://127.0.0.1/ex/main/upload/171/7d8be9ea82ce7908e9983010863e0bda.JPG 404 (Not Found) mypage.php:2164
GET http://127.0.0.1/ex/main/upload/170/a50e8f6dc3aa68355358dc80499aa876.jpg 404 (Not Found) mypage.php:2176
GET http://127.0.0.1/ex/main/upload/169/b15ea09c05357f4b6cdd640a5f753fc7.jpg 404 (Not Found) mypage.php:2188
GET http://127.0.0.1/ex/main/upload/168/54427a8d0a9bda54a85009d3ec8e5637.jpg 404 (Not Found) mypage.php:2200
GET http://127.0.0.1/ex/main/upload/167/ec38a378e0c7a574275facd0eaa94be3.jpg 404 (Not Found) mypage.php:2212
GET http://127.0.0.1/ex/main/upload/166/80592697b068d3fb5f763435e495b781.jpg 404 (Not Found) mypage.php:2232
GET http://127.0.0.1/ex/main/upload/140/ae2db3bacabf7ce24e124f4c412aa0a4.jpg 404 (Not Found) mypage.php:2244
GET http://127.0.0.1/ex/main/upload/126/babd6909334499074dcc00d9ba8bcd9b.jpg 404 (Not Found) mypage.php:2256
GET http://127.0.0.1/ex/main/upload/124/ 404 (Not Found) mypage.php:2268
GET http://127.0.0.1/ex/main/upload/122/e322c941a0f7ade3c2d71a873ff1ff78.png 404 (Not Found) mypage.php:2280
GET http://127.0.0.1/ex/main/upload/106/5adc33fc8a2ca65d90783727483f5016.png 404 (Not Found) mypage.php:2292
GET http://127.0.0.1/ex/main/upload/102/a3d2557f2845ebf8df3dc3e2678a2619.jpg 404 (Not Found) mypage.php:2312
GET http://127.0.0.1/ex/main/upload/101/7eb6b918c9831857f6ce02be6c1603b1.jpg 404 (Not Found) mypage.php:2324
GET http://127.0.0.1/ex/main/upload/94/cd47aeea746b8835a5e296511e42384c.jpg 404 (Not Found) mypage.php:2336
GET http://127.0.0.1/ex/main/upload/93/3058cf890c384265a22c065b4efe0538.jpg 404 (Not Found) mypage.php:2348
GET http://127.0.0.1/ex/main/upload/87/b4572d58eb659bfdd0e8fbfe39a70825.jpg 404 (Not Found) mypage.php:2360
GET http://127.0.0.1/ex/main/upload/82/fac774dfcd5d5b3cc6b0e0ab9cf5bf20.jpg 404 (Not Found) mypage.php:2372
GET http://127.0.0.1/ex/main/upload/80/891ca4ffae9470eb451ed4f938e280f4.jpg 404 (Not Found) mypage.php:2392
GET http://127.0.0.1/ex/main/upload/57/ 404 (Not Found) mypage.php:2404
GET http://127.0.0.1/ex/main/upload/56/ 404 (Not Found) mypage.php:2416
GET http://127.0.0.1/ex/main/upload/55/ 404 (Not Found) mypage.php:2428
GET http://127.0.0.1/ex/main/upload/54/ 404 (Not Found) mypage.php:2440
GET http://127.0.0.1/ex/main/upload/53/ 404 (Not Found) mypage.php:2452
GET http://127.0.0.1/ex/main/upload/52/ 404 (Not Found) mypage.php:2472
GET http://127.0.0.1/ex/main/upload/50/ 404 (Not Found) mypage.php:2484
GET http://127.0.0.1/ex/main/upload/49/ 404 (Not Found) mypage.php:2496
GET http://127.0.0.1/ex/main/upload/48/ 404 (Not Found) mypage.php:2508
GET http://127.0.0.1/ex/main/upload/46/ 404 (Not Found) mypage.php:2520
GET http://127.0.0.1/ex/main/upload/39/ 404 (Not Found) mypage.php:2532
GET http://127.0.0.1/ex/main/upload/36/ 404 (Not Found) mypage.php:2552
GET http://127.0.0.1/ex/main/upload/33/ 404 (Not Found) mypage.php:2564
GET http://127.0.0.1/ex/main/upload/27/bb7439252a1168e03b2068faac1ec4ba.JPG 404 (Not Found) mypage.php:2576
GET http://127.0.0.1/ex/main/upload/26/ 404 (Not Found) mypage.php:2588
GET http://127.0.0.1/ex/main/upload/25/ 404 (Not Found) mypage.php:2600
GET http://127.0.0.1/ex/main/upload/24/ 404 (Not Found) mypage.php:2612
GET http://127.0.0.1/ex/main/upload/23/ 404 (Not Found) mypage.php:2632
GET http://127.0.0.1/ex/main/upload/21/ 404 (Not Found) mypage.php:2644
GET http://127.0.0.1/ex/main/upload/85/ 404 (Not Found) mypage.php:2656
EDIT2。
我已經複製了源代碼並創建了html頁面,問題仍然存在。
但是,我發現它並不總是發生,它是間歇性的..我想這可能是有關的CPU負載,但只是檢查CPU使用率低也我已重新啓動Apache,但大多數時候問題仍然存在。
這是我整個的.htaccess
Options -Indexes
# serve custom error pages
ErrorDocument 400 /ex/main/error.php?e=400
ErrorDocument 401 /ex/main/error.php?e=401
ErrorDocument 403 /ex/main/error.php?e=403
ErrorDocument 404 /ex/main/error.php?e=404
ErrorDocument 500 /ex/main/error.php?e=500
ErrorDocument 503 /ex/main/error.php?e=503
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+ex/main/error\.php[\s] [NC]
RewriteRule^- [F]
RewriteLogLevel設置爲1
使用Firebug或可用的開發工具,並檢查了'Net'標籤,一旦你看到404,點擊它,看看它的數據發回,並考慮到在頁面加載,並檢查有沒有其他重定向沒有沒有資源。 – Prix