WordPress: ukususa isiqondisi URL isimiso sokubhala kabusha by .htaccess

Indlela ngqo ukufinyelela lwemibhalo empandeni iseva esingethe WordPress ilungiselelwe ukusebenza njenge-URL friendly?

htaccess

inkinga

Sonke siyazi ukuthi uma ufuna ukufinyelela lwemibhalo ku impande leseva, nje abeke lesizinda kulandele igama laleyo lwemibhalo. ke, isibonelo, uma lwemibhalo libizwa “ukulayisha”, ufinyelela ke ngekheli http://taylorlopes.com/uploads.

Inkinga iwukuthi lapho ukumisa WordPress (noma yiluphi olunye uhlelo) nge-URL friendly, lokho kwaba ikhasi elibizwa oxhumana nabo nge-URL http://taylorlopes.com/?page_id = 2, Kuba into efana http://taylorlopes.com/contatos. Qaphela ukuthi lokhu indlela entsha sokushaya URL (wathi friendly), sifana ukushaya lwemibhalo, ngokuba ukuthi oxhumana nabo empeleni akusiyo lwemibhalo, kodwa ikhasi elilodwa kuphela.

Ilogo, kusuka ngesikhathi unquma ukusebenzisa i-URL ngobungane ucingo kungenzeki lwemibhalo, ngoba WordPress uhumusha lokhu njengoba ucingo ikhasi, ngokusobala okuyinto alikho, aliphonse iphutha “Ops! Leli khasi alikwazi ukutholakala“. ke, indlela ukubiza lwemibhalo ngaphandle WordPress uhumusha le kholi njengekhasi?

isixazululo

Ukuxazulula lenkinga bese ukufinyelela ngqo lwemibhalo ku impande iseva ngaphandle ulichaze njengekhasi WordPress, ukuvula ifayela .htaccess futhi ukungeza umugqa ngezansi nje isitatimende sokuqala RewriteRule, ukushintshisana “mydir” igama lwemibhalo yakho yamanje:

subcode

RewriteCond %{REQUEST_URI} !^/(mydir|mydir/.*)$

ikhodi ephelele

# ZIQALA WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^ Inkomba .php $ - [L]
RewriteCond %{REQUEST_URI} !^/(mydir|mydir/.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /inkomba.php [L]
</IfModule>
# UKUPHELA WordPress

AMAZWI:

I .htaccess Kuyinto empandeni lwemibhalo lapho okuqukethwe Web ishicilelwe, ezifana lwemibhalo /www (wampserver) noma /htdocs (xampp).

Ukuqondisa kabusha

Iphuzu lapha liwukuthi ukwenza Thumela (ikhasi) akhawunti ye-URL friendly ezimbili, ngakho, lapho othile izinhlobo http://taylorlopes.com/about (ikhasi mayelana kukhona) kwafeza Ukuqondisa kabusha ukuze http://taylorlopes.com/sobre (ikhasi ku kukhona). Sebenzisa .htaccess ukuqondisa kabusha:

subcode

Qondisa kabusha /mayelana /ku

ikhodi ephelele

# ZIQALA WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^ Inkomba .php $ - [L]
RewriteCond %{REQUEST_URI} !^/(eziwusizo|eziwusizo/.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
Qondisa kabusha /mayelana /sobre
RewriteRule . /inkomba.php [L]
</IfModule>
# UKUPHELA WordPress

umthombo

WordPress: Ungafaki lwemibhalo kusuka ku-URL loba nge .htaccess

Imininingwane zokungena: 7860

Shiya impendulo

Ikheli lakho le ngeke ishicilelwe. Ezidingekayo ibhalwe nge *