Loaʻa nā ʻokoʻa i nā Rula WordPress

apache wordpress

apache wordpressUa hana ʻo WordPress i kahi holomua nui i mua i ka papahana blog, neʻe iā ia kokoke i kahi ʻōnaehana piha piha piha me ka huli loiloi, ʻoi aku ke kākoʻo no nā menus maʻamau, a me – ke hiʻohiʻona hoihoi loa iaʻu - ke kākoʻo pūnaewele maha me ka palapala ʻāina.

Inā ʻaʻole ʻoe he ʻōnaehana hoʻokele ʻike ʻike maikaʻi, maikaʻi. Hiki iā ʻoe ke lele ma mua o kēia ʻatikala. Akā no kaʻu mau hoa techno-geeks, poʻo poʻo a me apache-dabblers, makemake wau e kaʻana like i kahi mea hoihoi, a me kekahi mea maikaʻi.

ʻO Multi-site kahi hiʻohiʻona e ʻae iā ʻoe e holo i kekahi o nā pūnaewele WordPress me kahi hoʻonohonoho WordPress hoʻokahi. Inā ʻoe e hoʻokele i nā pūnaewele he nui, ʻoluʻolu ia no ka mea hiki iā ʻoe ke hoʻouka i kahi hui o nā poʻomanaʻo a me nā hāmeʻa i ʻae ʻia, a hoʻoiho iā lākou no nā pūnaewele o kāu mea kūʻai aku. Aia kekahi mau pilikia ʻenehana e palapala ʻāina i kāu mau kāʻei, akā ʻaʻole paʻakikī ka hana.

ʻO kekahi o nā wahi pilikia aʻu i ʻike ai aia ma ka hoʻonohonoho kumuhana. Ma muli o ka hiki ke hoʻolako ʻia i nā poʻomanaʻo i nā pūnaewele he nui, ʻo nā hana maʻamau āu e hana ai i kahi kumuhana e hoʻopili i nā pūnaewele ʻē aʻe e hoʻohana ana i kēlā kumuhana ma kāu hoʻouka pūnaewele maha. ʻO kaʻu ala a puni e hoʻopili i kahi kumuhana ma mua o ka hoʻomaka ʻana i ka hana maʻamau, a kapa inoa pono i ke poʻo inoa no ka pūnaewele mea lawelawe aʻu e kapa nei no ia.

ʻO kekahi pilikia hoihoi ka mea e hana ai i ka faila .htaccess ma kāu kikowaena Apache. Pono ʻo WordPress e kākau hou i nā ala ma ke kumu blog-by-blog a hana i kēia me kahi rula kākau hou a me kahi faila php.

Hoʻohana ʻo WordPress i kēia rula kākau hou:

RewriteRule ^ ([_ 0-9a-zA-Z -] + /)? Files /(.+) wp-hoʻokomo / ms-files.php? File = $ 2 [L]

ʻO ka mea nui, nā mea āpau i kahi subdirectory o mysite.com/files/directory e kākau hou ʻia i mysite.com/files/wp-includes/myblogfolderpath… a ʻo kēia kahi e hoihoi ai. He aha ka hana inā pono ʻoe e loaʻa kahi faila ma kāu kikowaena ʻo ia ka mysite.com/files/myfolder/myimage.jpg? Loaʻa iā ʻoe kahi hewa 404, ʻo ia ka mea e hana. Hoʻopiʻi ka lula kākau Apache a hoʻololi i ke ala.

ʻAe, ʻaʻole paha ʻoe e ʻike i kēia pilikia, akā ua hana wau. He pūnaewele kaʻu e pono ai e hoʻohana i kahi widget javascript mai kahi pūnaewele ʻē aʻe, a pono ia e ʻike i nā kiʻi ma mysite.com/files/Images/myfile. ʻOiai ʻaʻohe ala e hoʻololi ai i ka faila ma ka pūnaewele hoʻokipa, pono wau e noʻonoʻo i kahi ala e hana ai i kēia ma kaʻu kikowaena pūnaewele. ʻO ka hopena maʻalahi ka hana i kahi ʻano kākau hou e hana i kahi ʻokoʻa no nā faila kikoʻī.

Eia ka hopena:

RewriteCond% {REQUEST_URI}! /? Faile / Kiʻi / file1.jpg $
RewriteCond% {REQUEST_URI}! /? Faile / Kiʻi / file2.jpg $
RewriteRule ^ ([_ 0-9a-zA-Z -] + /)? Files /(.+) wp-hoʻokomo / ms-files.php? File = $ 2 [L]

Pono e kau i nā kūlana kākau hou ma mua o ka lula kākau hou, a i ʻole e holo ʻole kēia maʻa. He mea maʻalahi ke hoʻololi i kēia kūlana no kāu pono ponoʻī, inā ʻoe e hālāwai i kahi pilikia like. Ua maikaʻi ka hopena noʻu, e ʻae ana iaʻu e pani i nā kiʻi pilikino ma mua o nā ʻelima alt i makemake ʻole ʻia e kū ʻole i kaʻu hoʻolālā. Lana ka manaʻo, e hana nō ia nāu.

Pehea kou manaʻo?

Ke hoʻohana nei kēia pūnaewele i ka Akismet e ho'ēmi i ka spam. E aʻo pehea e hanaʻia ai kāuʻikeʻikepili.