Cov ntsiab lus Marketing

WordPress .htaccess Cov Cai Muaj Kev Zam, Ib yam nkaus

WordPress ua qhov tseem ceeb hloov tshiab rau hauv lub vev xaib blogging, txav nws mus ze rau cov txheej txheem kev tswj hwm cov ntsiab lus nrog kev rov qab taug qab, ntau dua kev txhawb nqa rau cov tub luam kev cai, thiab feature qhov tseem ceeb tshaj plaws rau kuv – ntau lub vev xaib txhawb nrog sau daim phiaj.

Yog tias koj tsis yog cov ntsiab lus tswj hwm qhov system junkie, nws tsis ua li cas. Koj tuaj yeem hla dhau ntawm kab lus no. Tab sis rau kuv cov phooj ywg techno-geeks, code-heads, thiab apache-dabblers, kuv xav qhia ib yam dab tsi nthuav, thiab ib yam dab tsi txias.

Ntau qhov chaw yog qhov tshwj xeeb uas tso cai rau koj los khiav ib tus lej ntawm WordPress lub vev xaib nrog ib qho WordPress installation. Yog tias koj tswj hwm ntau qhov chaw, nws yog qhov zoo vim tias koj tuaj yeem nruab ib pawg pom zoo ntawm cov ntsiab lus thiab widgets, thiab qhib lawv rau koj cov neeg siv khoom. Muaj ob peb txoj kev nyuaj rau kev kos npe rau koj cov npe, tab sis cov txheej txheem tsis nyuaj.

Ib qho ntawm cov teeb meem uas kuv tau txheeb xyuas yog kev hloov kho lub ntsiab lus. Txij li cov ntsiab lus tuaj yeem tsim muaj rau ntau lub vev xaib, txhua qhov kev hloov kho uas koj ua rau lub ntsiab lus tseem yuav cuam tshuam rau lwm qhov chaw siv cov ntsiab lus ntawm koj lub vev xaib ntau. Kuv txoj kev nyob ib ncig ntawm no yog kom duplicate lub ntsiab ua ntej kuv pib customizing, thiab kom meej meej npe lub ntsiab rau tus neeg siv qhov chaw kuv styling nws rau.

Lwm qhov teeb meem nthuav yog dab tsi tshwm sim hauv .htaccess cov ntaub ntawv ntawm koj lub Apache server. WordPress xav tau rov sau dua txoj hauv kev ntawm blog-los-blog hauv paus thiab ua qhov no nrog txoj cai rov sau dua thiab php ntawv.

WordPress siv txoj cai rov sau dua cov hauv qab no:

RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

Tawg, qhov no txhais tau tias:

  1. RewriteRule - Cov lus qhia no qhia Apache tias qhov no yog txoj cai rov sau dua.
  2. ^([_0-9a-zA-Z-]+/)? - Qhov no yog ib qho kev qhia tsis tu ncua (Txhab Nyiaj) uas phim ib txoj hlua ntawm cov cim uas pib nrog txoj hlua xaiv ntawm cov cim alphanumeric thiab hyphens ua raws li tus lej. Cov kab lus qhia txog pawg ntes, uas txhais tau hais tias cov ntawv sib tw tuaj yeem siv rau hauv txoj hlua hloov.
  3. files/ - Qhov no phim cov hlua "cov ntaub ntawv /".
  4. (.+) - Qhov no yog lwm pab pawg ntes uas phim cov hlua ntawm cov cim, ib lossis ntau zaus.
  5. wp-includes/ms-files.php?file=$2 - Qhov no yog txoj hlua hloov uas hloov txoj hlua sib tw. Nws qhia Apache kom hloov qhov kev thov mus rau "wp-includes/ms-files.php", nrog tus nqi ntawm pawg thib ob ntes ($ 2) raws li cov lus nug parameter hu ua "file".
  6. [L] - Qhov no yog tus chij uas qhia Apache kom tsis txhob ua cov cai ntxiv yog tias txoj cai no sib phim.

Qhov tseem ceeb, txhua yam uas yog nyob rau hauv subdirectory ntawm mysite.com/files/directory tau sau dua tshiab rau mysite.com/files/wp-includes/myblogfolderpath… thiab qhov no yog qhov uas nws tau txais nthuav. Yuav ua li cas yog tias koj xav tau muaj cov ntaub ntawv ntawm koj lub server uas yog mysite.com/files/myfolder/myimage.jpg? Koj tau 404 qhov yuam kev, qhov ntawd tshwm sim. The Apache rov sau txoj cai rov qab los rau hauv thiab pauv txoj kev.

Tso cai, koj yuav tsis tuaj hla qhov teeb meem no, tab sis kuv tau ua. Kuv muaj lub vev xaib uas xav tau siv javascript widget los ntawm lwm lub vev xaib, thiab nws xav tau nrhiav cov duab ntawm mysite.com/files/Images/myfile. Vim tias tsis muaj txoj hauv kev los hloov cov ntawv ntawm lub vev xaib, Kuv xav tau txoj kev los mus ua qhov no ntawm kuv lub server. Cov kev daws teebmeem yooj yim yog tsim kom tau sau ntawv rov qab uas ua rau muaj kev zam rau cov ntaub ntawv tshwj xeeb.

Ntawm no yog cov tshuaj:

RewriteCond %{REQUEST_URI} !/?files/Image/file1.jpg$
RewriteCond %{REQUEST_URI} !/?files/Image/file2.jpg$
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

Ua txhaum:

Kab 1:

  1. RewriteCond - Cov lus qhia no qhia Apache tias qhov no yog RewriteCond txoj cai.
  2. %{REQUEST_URI} - Qhov no yog qhov hloov pauv server uas muaj txoj hauv kev ntawm URI thov.
  3. ! - Qhov no yog tus neeg ua haujlwm tsis lees paub uas txhais tau tias "tsis yog". Nws yog siv los hloov qhov xwm txheej.
  4. /?files/Image/file1.jpg$ - Qhov no yog ib qho kev qhia tsis tu ncua uas phim cov kab tiag tiag "/files/Image/file1.jpg" tom kawg ntawm qhov thov URI. Cov lus nug cim thiab rau pem hauv ntej slash ua ntej "cov ntaub ntawv" ua tus thawj slash xaiv.

Kab 2:

  1. RewriteCond - Cov lus qhia no qhia Apache tias qhov no yog RewriteCond txoj cai.
  2. %{REQUEST_URI} - Qhov no yog qhov hloov pauv server uas muaj txoj hauv kev ntawm URI thov.
  3. ! - Qhov no yog tus neeg ua haujlwm tsis lees paub uas txhais tau tias "tsis yog". Nws yog siv los hloov qhov xwm txheej.
  4. /?files/Image/file2.jpg$ - Qhov no yog ib qho kev qhia tsis tu ncua uas phim cov kab tiag tiag "/files/Image/file2.jpg" tom kawg ntawm qhov thov URI. Cov lus nug cim thiab rau pem hauv ntej slash ua ntej "cov ntaub ntawv" ua tus thawj slash xaiv.

Kab 3:

  1. RewriteRule - Cov lus qhia no qhia Apache tias qhov no yog txoj cai rov sau dua.
  2. ^([_0-9a-zA-Z-]+/)? - Qhov no yog ib qho kev qhia tsis tu ncua uas phim cov hlua ntawm cov cim uas pib nrog txoj hlua xaiv ntawm cov cim alphanumeric thiab hyphens ua raws li tus lej. Cov kab lus qhia txog pawg ntes, uas txhais tau hais tias cov ntawv sib tw tuaj yeem siv rau hauv txoj hlua hloov.
  3. files/ - Qhov no phim cov hlua "cov ntaub ntawv /".
  4. (.+) - Qhov no yog lwm pab pawg ntes uas phim cov hlua ntawm cov cim, ib lossis ntau zaus.
  5. wp-includes/ms-files.php?file=$2 - Qhov no yog txoj hlua hloov uas hloov txoj hlua sib tw. Nws qhia Apache kom hloov qhov kev thov mus rau "wp-includes/ms-files.php", nrog tus nqi ntawm pawg thib ob ntes ($ 2) raws li cov lus nug parameter hu ua "file".
  6. [L] - Qhov no yog tus chij uas qhia Apache kom tsis txhob ua cov cai ntxiv yog tias txoj cai no sib phim.

Qhov rov sau ua ntej yuav tsum tau muab tso ua ntej txoj cai rov sau dua, lossis qhov kev dag no yuav tsis ua haujlwm. Nws yuav tsum yooj yim los hloov cov kev mob no rau koj tus kheej lub hom phiaj, koj puas yuav ntsib teeb meem zoo sib xws. Cov kev daws teeb meem tau ua haujlwm zoo rau kuv, uas cia kuv hloov daim duab kev cai zoo dua li tsis siv cov ntawv nyeem tsawg dua uas tsis haum rau kuv tus qauv. Vam tias, nws yuav ua haujlwm rau koj thiab.

Tim Piazza

Tim Piazza yog tus koom tes nrog Social LIfe Kev Lag Luam thiab tus tsim ntawm ProSocialTools.com, cov peev txheej lag luam me rau kev ncav cuag cov neeg siv khoom hauv zos nrog kev tshaj xov xwm thiab kev lag luam mobile. Thaum nws tsis tsim cov kev daws teeb meem tshiab uas ua kom cov txheej txheem ua lag luam, Tim nyiam ua si mandolin thiab khoom siv tes ua rooj tog.

lwm yam khoom

Rov qab mus rau sab saum toj
Close

Adblock nrhiav tau

Martech Zone muaj peev xwm muab cov ntsiab lus no rau koj yam tsis muaj nqi vim tias peb tau txais peb lub vev xaib los ntawm kev tshaj tawm cov nyiaj tau los, koom nrog kev sib txuas, thiab kev txhawb nqa. Peb yuav txaus siab yog tias koj yuav tshem koj cov ad blocker thaum koj saib peb lub xaib.