O Tulafono a le WordPress e iai foʻi tuusaunoaga

apache upu

apache upuO le WordPress na faia se laasaga taua tele i luma i le blogging platform, siitia ia latalata atu i le atoa-system content management system ma le toe teuteuina, sili atu lagolago mo menus custom, ma – le pito sili ona mataʻina foliga mo aʻu – tele-site lagolago ma le faʻafanua nofoaga.

If you are not a content management system junkie, it's okay. You can skip right past this article. But for my fellow techno-geeks, code-heads and apache-dabblers, I want to share something interesting, and something cool.

Multi-site is a feature that allows you to run any number of WordPress websites with a single WordPress installation. If you administer multiple sites, it's nice because you can install an approved group of themes and widgets, and activate them for your client sites. There are a few technical hurdles to map your domains, but the process is not difficult.

O se tasi o faʻafitauli o loʻo ou faʻailoaina o loʻo faʻaaogaina e le autu. Talu ai o autu e mafai ona faʻaavanoaina i le tele o '' upega tafaʻilagi, soʻo se faʻapitoa e te faia i se autu o le a aʻafia ai foʻi isi lava 'upega tafaʻilagi e faʻaaogaina lena autu i luga o lau tele-site install. O laʻu auala faataamilo i lenei mea o le kopiina o se autu ae ou te leʻi amataina masani, ma taʻu manino le autu mo le tagata o tausia 'upega tafaʻilagi o loʻo ou faʻaaogaina mo.

O le isi mataʻupu mataʻupu o le mea e tupu i le .htaccess faila i lau Apache server. E manaʻomia e le WordPress ona toe tusia ala i luga ole blog-by-blog ma faia ai lea tulafono toe tusi ma se faila php.

E faʻaaoga e le WordPress le tulafono toe tusi lenei:

RewriteRule ^ ([_ 0-9a-zA-Z -] + /)? Faila /(.+) wp-aofia ai / ms-files.php? Faila = $ 2 [L]

Essentially, anything that is in a subdirectory of mysite.com/files/directory gets rewritten to mysite.com/files/wp-includes/myblogfolderpath… and this is where it gets interesting. What happens if you actually need to have a file on your server that is mysite.com/files/myfolder/myimage.jpg? You get a 404 error, that's what happens. The Apache rewrite rule kicks in and changes the path.

Faʻamaoni, atonu e te le tau i lenei faʻafitauli, ae na ou iloa. Sa i ai laʻu 'upega tafaʻilagi e manaʻomia le faʻaaogaina o le javascript widget mai seisi' upega tafaʻilagi, ma e manaʻomia le sailia o ata i le mysite.com/files/Images/myfile. Talu ai e leai se auala e suia ai le faila i luga o le 'upega tafaʻilagi nofoaga, na ou manaʻomia ai le sailia o se auala e faia ai lenei i luga o laʻu' auʻaunaga. O le tali faigofie o le fatuina lea o se toe tusia tulaga e faia ai se tuusaunoaina mo faʻapitoa faila.

O le tali lea:

RewriteCond% {REQUEST_URI}! /? Faila / Ata / file1.jpg $
RewriteCond% {REQUEST_URI}! /? Faila / Ata / file2.jpg $
RewriteRule ^ ([_ 0-9a-zA-Z -] + /)? Faila /(.+) wp-aofia ai / ms-files.php? Faila = $ 2 [L]

The rewrite conditions have to be placed before the rewrite rule, or this trick won't work. It should be easy to modify this condition for your own purposes, should you encounter a similar problem. The solution worked great for me, allowing me to substitute custom graphics rather than the less desirable alt text that didn't suit my design. Hopefully, it will work for you, too.

O le'a sou manatu?

O lenei 'upega tafaʻilagi e faʻaaogaina le Akismet e faʻaitiitia le spam. Aoao pe faapefea ona faʻasoa lau faʻamatalaga faʻamatalaga.