以往自己做网页都习惯用`index.html`或者`index.php`来为主页命名,用在cPanel虚拟主机上也没发现任何问题。但是从网上下载一组网页后,并放到Apache2+Ubuntu的环境下,却发现默认的网页没被加载。 ![](https://steemitimages.com/DQmRkLq6rRew3mHfx4vYGWyqpC8wSebLPeC2iZCXAdpuGkR/image.png) (图源 :[pixabay](https://pixabay.com/)) # 默认网页 所谓的默认网页,就是我打开网址后不添加任何文件名,网站自动加载的页面。 比如打开https://eztk.net 会自动加载 https://www.eztk.net/index.php 这个`index.php`就是默认网页,在根目录下也被叫做网站的首页或者主页。 但是我下载的一组网页竟然用`default.html`做为主页,然后上传打开网址后,竟然没有被自动加载,这就尬尴了。 # 初级解决方法 一种解决方法是把`default.html`重命名为`index.html`,但是这样可能破坏其它关联页面到这个网页的链接。 另外一种方法是复制一个`index.html`包含与`default.html`同样的内容,但是这样做可能影响SEO被搜索引擎降权。 # DirectoryIndex指令 既然上述方法不理想,那么就要尝试从Apache下手解决了,要想解决这个,首先要知道Apache如何查找默认网页的。 在Apache2目录下搜索`index.html`,我们会得到类似如下内容: >![](https://cdn.steemitimages.com/DQmaqFwL4hVyBznzDzU8h6UKteGADcy91WoNa2n7sJgjznM/image.png) 原来控制缺省网页是用的[DirectoryIndex 指令](https://httpd.apache.org/docs/2.4/mod/mod_dir.html),详情大家可以参考文末链接,这里就不再赘述了。 # 终极解决方法 知道了这点,解决上述问题就很简单了,把`default.html`加入到`DirectoryIndex 指令`下(捎带删除我从来不用的),并重启Apache即可。 ``` <IfModule mod_dir.c> DirectoryIndex index.html index.php index.htm default.html </IfModule> ```` 重新加载Apache2 >`sudo systemctl reload apache2` 或者重启Apache2 >`sudo systemctl restart apache2` 哈哈,不用重命名也不用弄分身COPY,访问站点URL,`default.html`自动加载啦。 # 相关链接 * [DirectoryIndex Directive](https://httpd.apache.org/docs/2.4/mod/mod_dir.html#directoryindex) ---- <center><strong>Vote For Me As Witness</strong> https://steemit.com/~witnesses type in **`oflyhigh`** and click ***`VOTE`*** [![](https://cdn.steemitimages.com/DQmX5NysqT44FBa3bhuWqQ69nAbseu8Nt5YQPn2pYejPVxA/image.png)](https://steemit.com/~witnesses) [Vote @oflyhigh via Steemconnect](https://steemconnect.com/sign/account-witness-vote?witness=oflyhigh&approve=1) <strong>Thank you!</strong></center>
post_id | 79,897,348 |
---|---|
author | oflyhigh |
permlink | ubuntu-apache2 |
category | cn |
json_metadata | {"tags":["cn","apache","index","ubuntu","seo"],"image":["https:\/\/steemitimages.com\/DQmRkLq6rRew3mHfx4vYGWyqpC8wSebLPeC2iZCXAdpuGkR\/image.png","https:\/\/cdn.steemitimages.com\/DQmaqFwL4hVyBznzDzU8h6UKteGADcy91WoNa2n7sJgjznM\/image.png","https:\/\/cdn.steemitimages.com\/DQmX5NysqT44FBa3bhuWqQ69nAbseu8Nt5YQPn2pYejPVxA\/image.png"],"links":["https:\/\/pixabay.com\/","https:\/\/eztk.net","https:\/\/www.eztk.net\/index.php","https:\/\/httpd.apache.org\/docs\/2.4\/mod\/mod_dir.html","https:\/\/httpd.apache.org\/docs\/2.4\/mod\/mod_dir.html#directoryindex","https:\/\/steemit.com\/~witnesses","https:\/\/steemconnect.com\/sign\/account-witness-vote?witness=oflyhigh&approve=1"],"app":"steemit\/0.1","format":"markdown"} |
created | 2019-09-11 00:29:06 |
last_update | 2019-09-11 00:29:06 |
depth | 0 |
children | 4 |
net_rshares | 57,535,337,879,947 |
last_payout | 2019-09-18 00:29:06 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 11.742 SBD |
curator_payout_value | 11.517 SBD |
pending_payout_value | 0.000 SBD |
promoted | 0.000 SBD |
body_length | 1,765 |
author_reputation | 1,148,153,621,496,884 |
root_title | 每天进步一点点:Ubuntu下修改Apache2默认网页(主页) |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 SBD |
percent_steem_dollars | 10,000 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
abit | 0 | 1,007,596,348,778 | 100% | ||
adm | 0 | 16,620,250,092,436 | 100% | ||
ivan-perez-anies | 0 | 5,810,998,405 | 5.69% | ||
thecryptodrive | 0 | 587,556,081,891 | 25% | ||
wongshiying | 0 | 23,450,581,258 | 100% | ||
norbu | 0 | 107,971,323,960 | 50% | ||
blockchainbilly | 0 | 5,702,433,025 | 50% | ||
nascimentoab | 0 | 123,186,824 | 5% | ||
jesse5th | 0 | 60,697,441 | 50% | ||
deanliu | 0 | 1,695,935,340,580 | 100% | ||
rea | 0 | 1,235,885,731,036 | 40% | ||
joythewanderer | 0 | 411,323,075,835 | 40% | ||
ace108 | 0 | 530,126,424,440 | 25% | ||
alex2016 | 0 | 81,214,083 | 100% | ||
laoyao | 0 | 43,343,498,061 | 100% | ||
somebody | 0 | 13,040,900,497 | 100% | ||
midnightoil | 0 | 152,053,588,879 | 100% | ||
xiaohui | 0 | 863,448,473,440 | 100% | ||
silentlucidity53 | 0 | 0 | 75% | ||
riosparada | 0 | 165,854,601,435 | 100% | ||
oflyhigh | 0 | 3,324,976,254,100 | 100% | ||
xiaokongcom | 0 | 216,560,136 | 100% | ||
yulan | 0 | 16,407,535,233 | 100% | ||
rivalhw | 0 | 1,955,822,729,573 | 100% | ||
chinadaily | 0 | 122,375,755,179 | 100% | ||
helene | 0 | 1,131,857,793,987 | 100% | ||
ffcrossculture | 0 | 217,455,378,207 | 100% | ||
ethansteem | 0 | 385,298,858,386 | 100% | ||
sweetsssj | 0 | 19,168,970,596,966 | 50% | ||
tumutanzi | 0 | 66,532,367 | 0.05% | ||
penguinpablo | 0 | 549,619,831,610 | 10% | ||
cleateles | 0 | 70,439,864 | 5% | ||
jianghao | 0 | 181,676,029 | 10% | ||
lalala | 0 | 147,691,155,478 | 100% | ||
bukiland | 0 | 300,449,939 | 3.14% | ||
dapeng | 0 | 41,569,715,753 | 100% | ||
devilwsy | 0 | 2,502,864,393 | 100% | ||
janiceting | 0 | 2,500,670,195 | 100% | ||
newhope | 0 | 2,661,509,596,294 | 29% | ||
em3di | 0 | 512,136,596 | 2.5% | ||
blackbunny | 0 | 42,059,993,940 | 100% | ||
elizacheng | 0 | 8,217,785,452 | 9% | ||
bxt | 0 | 228,447,594,311 | 100% | ||
lingfei | 0 | 80,931,580,194 | 100% | ||
slh84 | 0 | 33,047,536 | 50% | ||
yyyy | 0 | 452,106,572 | 100% | ||
alexis555 | 0 | 2,309,185,250,602 | 29% | ||
austinsandersco | 0 | 722,603,929 | 70% | ||
teachblogger | 0 | 2,005,921,718 | 50% | ||
kingofdew | 0 | 45,609,501,825 | 100% | ||
htliao | 0 | 32,148,095,382 | 20% | ||
frankintaiwan | 0 | 11,863,186 | 10% | ||
wylo | 0 | 628,633,033 | 100% | ||
jkkim | 0 | 27,068,039 | 10% | ||
ebejammin | 0 | 5,964,335,802 | 100% | ||
rycharde | 0 | 1,675,557,297 | 2.95% | ||
cryptohustler | 0 | 30,398,567,264 | 100% | ||
exec | 0 | 113,367,827,517 | 100% | ||
eval | 0 | 767,973,514 | 100% | ||
speeding | 0 | 3,667,502,635 | 100% | ||
walkinharmony | 0 | 26,190,617,587 | 40% | ||
asterix87 | 0 | 13,814,295,405 | 100% | ||
canbethisone | 0 | 139,863,022 | 50% | ||
benedict08 | 0 | 42,542,526,100 | 20% | ||
trenz | 0 | 6,520,724,880 | 5.69% | ||
abetterworld | 0 | 2,912,717,932 | 100% | ||
raili | 0 | 1,388,511,930 | 50% | ||
otom | 0 | 25,769,359,069 | 20% | ||
jeffrey24864 | 0 | 18,983,915,688 | 100% | ||
that1consultant | 0 | 252,556,455 | 100% | ||
sanzo | 0 | 581,916,666 | 100% | ||
davaowhenyo | 0 | 555,161,267 | 100% | ||
allenshayzar | 0 | 555,678,180 | 100% | ||
raku | 0 | 691,730,618 | 100% | ||
resteeming | 0 | 544,754,946 | 100% | ||
ravenousappetite | 0 | 615,273,749 | 100% | ||
aabb | 0 | 7,560,290,202 | 100% | ||
catwomanteresa | 0 | 83,653,325,799 | 50% | ||
auntigormint | 0 | 487,652,273 | 100% | ||
mrliga | 0 | 21,299,460,038 | 100% | ||
oldman28 | 0 | 18,185,594,896 | 45% | ||
sweethoney | 0 | 1,539,026,188 | 100% | ||
liangfengyouren | 0 | 1,949,627,801 | 50% | ||
idx | 0 | 20,164,719,781 | 100% | ||
jiangchen | 0 | 21,309,048,508 | 100% | ||
openledgerio | 0 | 372,344,842 | 73% | ||
commbank | 0 | 355,356,713 | 70% | ||
lancy | 0 | 4,627,857,644 | 92% | ||
icmarkets | 0 | 326,029,994 | 65% | ||
cn-reader | 0 | 11,511,950,897 | 50% | ||
tvb | 0 | 20,356,147,955 | 30% | ||
skenan | 0 | 77,097,931,697 | 50% | ||
bearpaw | 0 | 422,872,650 | 100% | ||
kimzwarch | 0 | 23,877,220,788 | 12.5% | ||
bboyady | 0 | 1,044,791,285 | 5% | ||
freedom-fighter | 0 | 554,871,599 | 100% | ||
accelerator | 0 | 7,056,110,539 | 0.39% | ||
technologynepal | 0 | 554,660,211 | 100% | ||
chenlocus | 0 | 0 | 40% | ||
davidke20 | 0 | 14,916,536,576 | 10% | ||
sbdraffle | 0 | 207,262,746 | 44% | ||
dgorbunov | 0 | 516,335,885 | 100% | ||
robertoueti | 0 | 1,428,388,056 | 3% | ||
khalilad | 0 | 568,431,958 | 100% | ||
ms8988 | 0 | 545,277,923 | 100% | ||
minloulou | 0 | 446,903,664 | 3% | ||
rollsman | 0 | 4,621,418,302 | 100% | ||
stakuza | 0 | 345,246,478 | 100% | ||
flaviusbusck | 0 | 70,438,213 | 5% | ||
cryptocurrencyhk | 0 | 292,917,514 | 20% | ||
holmesian | 0 | 151,300,224 | 100% | ||
ikonik | 0 | 343,531,738 | 100% | ||
vfxness | 0 | 17,564,599 | 100% | ||
lemminon | 0 | 555,428,463 | 100% | ||
heyeshuang | 0 | 607,619,547 | 100% | ||
pataty69 | 0 | 44,573,873,774 | 51% | ||
razor80 | 0 | 547,764,907 | 100% | ||
fastiduos | 0 | 615,259,554 | 100% | ||
winniex | 0 | 7,725,442,356 | 20% | ||
rebecca80 | 0 | 148,716,191 | 100% | ||
weavingwords | 0 | 59,306,724,530 | 100% | ||
nitro.live | 0 | 261,025,613 | 100% | ||
naturald | 0 | 300,696,897 | 5% | ||
huatanzhang | 0 | 861,929,979 | 50% | ||
chaerin | 0 | 163,500,071 | 100% | ||
windowglass | 0 | 18,584,354,557 | 30% | ||
cnbuddy | 0 | 1,581,819,253 | 0.1% | ||
chann | 0 | 5,720,152,429 | 20% | ||
etherpunk | 0 | 32,665,950,568 | 20% | ||
itchyfeetdonica | 0 | 132,405,736,996 | 60% | ||
coindzs | 0 | 5,753,929,869 | 100% | ||
cryptonized | 0 | 44,899,217,998 | 10% | ||
ooairbb | 0 | 184,031,973 | 100% | ||
maiyude | 0 | 1,301,819,609 | 50% | ||
suhunter | 0 | 852,578,302 | 50% | ||
mermaidvampire | 0 | 24,984,922,412 | 12.5% | ||
onepracticalcat | 0 | 37,599,597 | 50% | ||
jimcustodio | 0 | 2,178,274,768 | 50% | ||
tmarisco | 0 | 293,160,787 | 5% | ||
casberp | 0 | 38,362,095,721 | 5% | ||
nostalgic1212 | 0 | 20,415,555,700 | 28% | ||
fireguardian | 0 | 93,949,370 | 5% | ||
historylover | 0 | 147,865,459 | 100% | ||
heiduya | 0 | 77,388,521 | 30% | ||
cryptoabstract | 0 | 695,426,518 | 100% | ||
camillagomes | 0 | 83,032,563 | 20% | ||
btccurrency1 | 0 | 62,848,139 | 100% | ||
ethanlee | 0 | 3,643,020,393 | 100% | ||
kymio | 0 | 522,506,467 | 3.75% | ||
fredo77200 | 0 | 3,621,295,230 | 100% | ||
fanso | 0 | 1,640,048,141 | 100% | ||
aellly | 0 | 3,237,164,657 | 5% | ||
cryptoknight27 | 0 | 341,364,651 | 100% | ||
icocnito | 0 | 186,262,073 | 100% | ||
khayziljoy | 0 | 46,381,346 | 100% | ||
angelinafx | 0 | 694,400,834 | 0.19% | ||
andrewma | 0 | 3,249,579,011 | 20% | ||
hranhuk | 0 | 6,016,700,232 | 40% | ||
mynotsofitlife | 0 | 823,123,516 | 10% | ||
eraizel | 0 | 111,273,584 | 5% | ||
hmayak | 0 | 7,387,336,977 | 100% | ||
archisteem | 0 | 3,573,961,760 | 7.5% | ||
agoha | 0 | 222,416,203 | 50% | ||
failarmyvideos | 0 | 546,276,485 | 100% | ||
moneybaby | 0 | 2,055,839,886 | 5% | ||
steemprotect | 0 | 3,249,707,472 | 3% | ||
bambugrove | 0 | 520,446,749 | 100% | ||
astros | 0 | 143,351,202 | 100% | ||
partiko | 0 | 254,063,024,226 | 3.01% | ||
money-way | 0 | 518,126,431 | 100% | ||
fabio.hranhuk | 0 | 161,127,721 | 40% | ||
yestermorrow | 0 | 8,489,558,827 | 31% | ||
deividluchi | 0 | 170,604,731 | 5% | ||
alijewel | 0 | 576,330,551 | 100% | ||
blues-wclouds | 0 | 792,305,954 | 100% | ||
fabianehranhuk | 0 | 159,546,859 | 40% | ||
julian2013 | 0 | 13,295,476,236 | 20% | ||
idakarlsen | 0 | 98,263,470,309 | 25% | ||
cryptouno | 0 | 132,919,527 | 3% | ||
astromaniac | 0 | 127,430,703 | 100% | ||
evelaurie | 0 | 83,418,038 | 30% | ||
yalehazlitt | 0 | 83,256,919 | 30% | ||
eltonwright | 0 | 77,598,486 | 30% | ||
zorapolly | 0 | 77,702,878 | 30% | ||
yettawild | 0 | 77,702,875 | 30% | ||
bobarchibald | 0 | 77,703,612 | 30% | ||
annasandy | 0 | 77,703,610 | 30% | ||
tbtek | 0 | 93,191,702 | 25% | ||
duarte9sousa | 0 | 2,207,494,022 | 4.95% | ||
hongman96 | 0 | 369,711,084 | 100% | ||
laissez-faire | 0 | 105,638,598 | 100% | ||
emmyluluameh | 0 | 56,741,257 | 50% | ||
lkvictor2005 | 0 | 16,195,474,264 | 100% | ||
jamzmie | 0 | 11,657,212,777 | 15% | ||
sasaadrian | 0 | 11,579,936,936 | 20% | ||
votes4minnows | 0 | 4,830,769,090 | 5.69% | ||
sskiller | 0 | 78,247,571 | 30% | ||
phatima | 0 | 241,043,929 | 7% | ||
goodcontentbot | 0 | 55,454,908 | 50% | ||
a-secondchance | 0 | 147,868,274 | 10% | ||
cecilian | 0 | 1,964,813,013 | 100% | ||
hamsa.quality | 0 | 390,918,474 | 5% | ||
killerbot | 0 | 201,193,860 | 30% | ||
ruggedbeardmedia | 0 | 167,247,118 | 100% | ||
jongreat | 0 | 26,174,598 | 100% | ||
onecent | 0 | 4,359,689,040 | 14% | ||
hyborian-strain | 0 | 1,791,285,865 | 30% | ||
mapxv | 0 | 9,963,597,811 | 1.17% | ||
wenjiewu | 0 | 9,687,737 | 25% | ||
teresa.yaiyai | 0 | 5,975,347,659 | 100% |
Thank you so much for participating in the Partiko Delegation Plan Round 1! We really appreciate your support! As part of the delegation benefits, we just gave you a 3.01% upvote! Together, let’s change the world!
post_id | 79,898,443 |
---|---|
author | partiko |
permlink | re-ubuntu-apache2-20190911t013013 |
category | cn |
json_metadata | {"app":"partiko"} |
created | 2019-09-11 01:30:15 |
last_update | 2019-09-11 01:30:15 |
depth | 1 |
children | 0 |
net_rshares | 24,718,243 |
last_payout | 2019-09-18 01:30:15 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 SBD |
curator_payout_value | 0.000 SBD |
pending_payout_value | 0.000 SBD |
promoted | 0.000 SBD |
body_length | 213 |
author_reputation | 39,204,266,552,701 |
root_title | 每天进步一点点:Ubuntu下修改Apache2默认网页(主页) |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 SBD |
percent_steem_dollars | 10,000 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
celine-robichaud | 0 | 24,718,243 | 25% |
Just only need redirect 301 the default.html to index.html, and all will be solved :)
post_id | 79,902,739 |
---|---|
author | growupjv |
permlink | pxnjmv |
category | cn |
json_metadata | {"tags":["cn"],"app":"steemit\/0.1"} |
created | 2019-09-11 05:37:45 |
last_update | 2019-09-11 05:37:45 |
depth | 1 |
children | 1 |
net_rshares | 819,059,946,251 |
last_payout | 2019-09-18 05:37:45 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.097 SBD |
curator_payout_value | 0.097 SBD |
pending_payout_value | 0.000 SBD |
promoted | 0.000 SBD |
body_length | 85 |
author_reputation | 33,113,112,148 |
root_title | 每天进步一点点:Ubuntu下修改Apache2默认网页(主页) |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 SBD |
percent_steem_dollars | 10,000 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
oflyhigh | 0 | 819,059,946,251 | 25% |
It's really a good idea.👍
post_id | 79,908,792 |
---|---|
author | oflyhigh |
permlink | pxnygt |
category | cn |
json_metadata | {"tags":["cn"],"app":"steemit\/0.1"} |
created | 2019-09-11 10:58:09 |
last_update | 2019-09-11 10:58:09 |
depth | 2 |
children | 0 |
net_rshares | 0 |
last_payout | 2019-09-18 10:58:09 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 SBD |
curator_payout_value | 0.000 SBD |
pending_payout_value | 0.000 SBD |
promoted | 0.000 SBD |
body_length | 25 |
author_reputation | 1,148,153,621,496,884 |
root_title | 每天进步一点点:Ubuntu下修改Apache2默认网页(主页) |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 SBD |
percent_steem_dollars | 10,000 |
高手,看您发布的文章,被点赞那么多,获得美金不少??能问下到底怎么玩steem才真正能像你一样赚那么多美金吗!??真诚求教!? 来自于 [WhereIn Android] (http://www.wherein.io)
post_id | 79,962,955 |
---|---|
author | bowen11 |
permlink | wherein-1568357989220 |
category | cn |
json_metadata | {} |
created | 2019-09-13 06:59:51 |
last_update | 2019-09-13 06:59:51 |
depth | 1 |
children | 0 |
net_rshares | 0 |
last_payout | 2019-09-20 06:59:51 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 SBD |
curator_payout_value | 0.000 SBD |
pending_payout_value | 0.000 SBD |
promoted | 0.000 SBD |
body_length | 110 |
author_reputation | 3,557,223,159,170 |
root_title | 每天进步一点点:Ubuntu下修改Apache2默认网页(主页) |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 SBD |
percent_steem_dollars | 10,000 |