WordPress: Permalinks

ကျွန်တော့်ရဲ့ WordPress: The Perfect Setup မှာ WordPress ကို အကောင်းဆုံးဖြစ်အောင် ဘယ်လို Install လုပ်ရမယ်ဆိုတာ ရေးခဲ့ပြီးပါပြီ။ အခုတစ်ခါ Preety Url လို့ခေါ်တဲ့ Permalinks တွေ အေကြောင်းဆက်ပါမယ်။ ဒီ Permalinks structure တွေဟာလဲ SEO ပိုင်းမှာ အရေးကြီးပါတယ်။

WordPress ရဲ့ permalink sturcture က တော်လေး ရုပ်ဆိုပါတယ်။ ဒီလိုပုံစံမျိုးပါ။

http://mydomain.com/?p=15

ကဲ အဲဒါဘာ page လဲ။ WordPress က ဘာလို့များ အဲဒီထက် ကောင်းတဲ့ setting ကို default အဖြစ် မသုံးတာလဲ။ ဘာလို့လဲဆိုတော့ ဒီ setting က server လဲ ရွေးဖူး၊ တခြားဘာ configuration မှလဲ လုပ်စရာ မလိုပဲ သုံးနိုင်လို့ပါ။ “?p=” က Post (or) Page ID တွေကို reference လုပ်ပါတယ်။ “=” sign ရဲ့ နောက်က တန်ဖိုးတွေကတော့ parameter တွေပါ။ အပေါ်ကလင့်က WordPress ကို ID 12 ရှိတဲ့ Post (or) Page ကို ထုတ်ပြပေးပါ ဆိုတဲ့ သဘောပါ။

ဒါပေမယ့် ဒီ default URL တွေထက်စာရင် http://mydomain.com/super-big-contest/ ဆိုတဲ့ ပုံစံမျိုးက ပိုပြီး ဖတ်ရတာလဲ အဆင်ပြေပါတယ်။ အဲဒါကို Preety URLs လို့လဲ ခေါ်ပါတယ်။ ပုံမှန်တိုင်းဆိုရင်တော့ server က super-big-contest ဆိုတဲ့ file (or) sub-directory ကို သွားရှာပြီး မရှိဖူး ပြောမှာပါ။ အခု WordPress တို့လို Dynamic platform မှာတော့ အဲလို မရှိတဲ့ fake directory structure ကို .htaccess file လေးရဲ့ အကူအညီနဲ့ ဆောက်ပါတယ်။

HTAccess

File name အပြည့်အစုံကတော့ “.htaccess” ပါ။ “.” (period) နဲ့ စပြီး file extension မပါပါဘူး။ Windows ပဲ သုံးဖူးတဲ့ သူတွေ အတွက်တော့ ထူးဆန်းနေပါလိမ့်မယ်။ တချို့ Operating System တွေ (Mac OS X, Linus, etc ) တွေမှာ ဒီလို “.” နဲ့ စတဲ့ဖိုင်တွေက hidden file တွေဖြစ်ပါတယ်။ WordPress ရဲ့ default download မှာ အဲဒီဖိုင် ပါမလာပါဘူး။ ဒါပေမယ့် ဒီ “.htaccess” ဖိုင်က WordPress ရဲ့ permalink structure တွေကို handle လုပ်ပါတယ်။

“.htaccess” file ဟာ wordpree install ထားတဲ့ root directory မှာ ရှိသင့်ပါတယ်။ ဒါပေမယ့် ခုမှ တင်ပြီး ပြီးချင်း ဆိုရင်တော့ ရှိဦးမှာ မဟုတ်ပါဘူး။ Server အများစုမှာတော့ WordPress က “.htaccess” file ကို auto ဆောက်နိုင်ပါတယ်။

WP Admin Panel ကနေ Settings -> Permalinks ကိုသွားလိုက်ပါ။ အဲဒီမှာ Default မဟုတ်တဲ့ တခြား setting တစ်ခုကို ရွေးပြီး save လုပ်လိုက်ပါ။

Permalink structure updated.

လို့ ပေါ်လာရင် WordPress က “.htaccess” file ကို ဆောက်လို့ ပီးသွားပါပြီ။ သူထဲမှာလဲ လိုအပ်တဲ့ code တွေ ထည့်ရေးပြီး သွားပါပြီ။ အဲလို ပေါ်မလာခဲ့ဘူး ဆိုရင်တော့ ကိုယ့်ဟာကိုပဲ သွားရေးမှ ရပါတော့မယ်။ ဒါပေမယ့် လွယ်ပါတယ်။ WP root directory မှာ “.htaccess” file တစ်ခု ဆောက်လိုက်ပါ။ ပြီးရင် edit လုပ်ပြီး အောက်ပါ HTAccess code တွေ ရေးထည့်ပေးလိုက်ပါ။

# Begin WordPress
<IfModule mod_rewrite.c>
 RewriteEngine On
 RewriteBase /
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule . /index.php [L]
</IfModule>
# End WordPress

Which Style of Permalinks

WordPress က ကျွန်တော်တို့ကို ကိုယ်ပိုင် permalink structure ရွေးခွင့် ပေးထားပါတယ်။ ကိုယ့်စိတ်ကြိုက် ဆိုပေမယ့်လည်း ဆိုက်နဲ့ ဆက်စပ်မယ့် ပုံစံကို ရွေးဖို့လဲ အရေးကြီးပါတယ်။ ဥပမာ – ကိုယ့်ဆိုက်က မကြာခဏ ပို့စ်တွေတင်နေတဲ့ blog တစ်ခုဆိုပါစို့။ “/%year%/%monthnum%/%day%/%postname%/” structure က အကောင်းဆုံး ပုံစံဖြစ်ပါမယ်။ ဒါပေမယ့် သီချင်း album တွေ review လုပ်တဲ့ site မျိုးဆိုရင်တော့ “/reviews/albums/%postname%/ structure က ပိုပြီး အဓိပ္ပါယ် ရှိပါလိမ့်မယ်။

Examples of different permalink structures

ကျွန်တော်တို့ MyanmarTutorials မှာတော့

http://www.myanmartutorials.com/programming/php/php-using-php-with-html-forms/

/main-category/sub-category/postname structure ကို သုံးထားပါတယ်။

QuotesOnDesign.com မှာတော့ date က အရေးမကြီးလို့ ထင်ပါတယ်။ ရိုးရိုးရှင်းရှင်းပဲ

http://quoteondesign.com/felix-sockwell/

ပုံစံကို သုံးထားပါတယ်။

Pick One and Stick With It

Permalink structure တစ်ခု ရွေးပြီး သွားပီဆိုရင်တော့ တောက်လျှောက် အဲဒါကိုပဲ သုံးပါလို့ အကြံပေးချင်ပါတယ်။ ဘာလို့လဲဆို တခြားသူတွေက အဲဒီလင့်တွေကို သုံးပြီး ကိုယ့်ဆိုက်ကို လာချိတ်ကြမယ်၊ Search Engine တွေကလဲ အဲဒီလင့်တွေနဲ့ ပဲ Index လုပ်ထားမယ်။ တကယ်လို့ ကိုယ်က permalink structure ပြောင်းလိုက်ရင် အရင်က ချိတ်ထားတဲ့ လင့်တွေကနေ ဝင်လာရင် 404 Not Found error တက်တတ်ပါတယ်။ ဒါပေမယ့် နောက်ပိုင်း WordPress version တွေက အဲလို ပြောင်းလိုက်တဲ့ လင့်တွေကိုလဲ redirect လုပ်ပေးနိုင်ပါတယ်။ ဒါပေမယ့် ယူဇာတွေရဲ့ browser တွေမှာတော့ လှလှပပ ပေါ်မှာ မဟုတ်ပါဘူး။ တခြား ကိုယ်လုပ်ထားတဲ့ SEO method တွေအတွက်လည်း အကျိုးမရှိပါဘူး။

SEO Consideration: Mind Your Post “Slugs”

Slug ဆိုတာက URL မှာ ပါတဲ့ post name ကို ဖတ်လို့ အဆင်ပြေအောင် search engine friendly ဖြစ်အောင် ပြန်ရေးထားတဲ့ special post name ပါပဲ။ ဥပမာ – ကျွန်တော်တို့က “57 Ways to Cook a Gizzard, Plus One Way You should Definitely not Cook a Gizzard” ဆိုတဲ့ title နဲ့ post တစ်ခုရေးရင် WordPress က

“57-ways-to-cook-a-gizzard-plus-one-way-you-should-definitely-not-good-a-gizzard”

ဆိုတဲ့ Slug ကို auto ထုတ်ပေးပါတယ်။ ကျနော်တို့ permalink structure မှာ သုံးခဲ့တဲ့ %postname% က အဲဒီ process ကို လုပ်ပေးပါတယ်။ အများစုကတော့ အဲလို အရမ်းရှည်တဲ့ post slug မျိုးကို SEO အတွက် မစဉ်းစားသင့်ဖူးလို့ ဆိုပါတယ်။ post title ရှည်လဲ စိတ်မညစ်ပါနဲ့ ၊ post ကို တစ်ခါ save လုပ်ပြီးရင် title box ရဲ့ အောက်နားလေးမှာ Slug ကို ပြင်ဖို့ box လေး တစ်ခု ထပ်ပေါ်လာပါလိမ့်မယ်။ အဲဒီမှာ ပြင်လို့ ရပါတယ်။ special character တွေ မသုံးပါနဲ့။ lowercase letters, numbers, dash တွေပဲ သုံးပါ။

ကျွန်တော်တို့ ဥပမာအတွက် ပိုကောင်းတဲ့ Slug ကို ပြပါမယ်။

Good: http://gizzard.com/how-to-cook-a-gizzard

ဒီပုံစံတွေကတော့ လုံးဝ မကောင်းပါဖူး။

Bad: http://bad-jokes.com/really-dumb-jokes/10/2009/your-momma-is-so-fat-she-
sat-on-a-dollar-and-made-four-quarters

Really Bad: http://www.surfboardsforyou.com/boards/filename.php?id=F98ZF4&prod
uctId=39222&section=wicked&brand=582&template=532

How to Change the Permalink Settings

  1. WordPress မှာ permalink setting တွေ ပြောင်းဖို့ အတွက် admin right ရှိတဲ့ အကောင့်နဲ့ Admin Panel ကို Log in ဝင်လိုက်ပါ။
  2. Admin Panel မှာ Setting -> Permalinks ကို ဆက်ဝင်ပါ။
  3. Permalink Settings page မှာ ကိုယ်ကြိုက်တဲ့ ပုံစံတစ်ခု ရွေးခဲ့ပါ။ အဆင်သင့်ပေးထားတဲ့ ပုံစံတွေ မကြိုက်ရင် Custom Structure ကို ရွေးပြီး %category%, %postname%, %year% စတဲ့ variable တွေ သုံးပြီး ကိုယ်ပိုင် structure တစ်ခု ဆောက်ပါ။

သုံးနိုင်တဲ့ variable တွေကို WordPress Documentation မှာ ဖတ်နိုင်ပါတယ်။

Facebook comments:

3 Responses

  1. Thiha says:

    တင်ပြပုံကော ရေးသားပုံကော အများကြီးကောင်းလာတယ်ဗျို့ … Cheer!

  2. ကျွန်တော့်မှာ ဆုိုဒ်အသစ်တခုု ထပ်ဆွဲနေရပါတယ်။ (A) ဆုိုဒ်ဆုိုပါစုို့။ ဒိုုမိန်းနိမ်းလည်း အသစ်ပါ။ ဒါပေမယ့် (A) ဆုိုဒ် တင်မယ့် ပိုု့စ်တွေက အခုုလက်ရှိ Run နေတဲ့ ဆုိုဒ် (B) ဆုိုဒ် မှာ တင်ထားတဲ့ ပုို့စ်အတုိုင်းပါပဲ။ ဒေတာတွေ အကုုန်အတူတူဖြစ်ပါလိမ့်မယ်။ သူတုို့ လုိုချင်တဲ့ ပုုံစံက B ဆုိုဒ် က ပုို့စ်တခုုခုုကုို ဝင်လုိုက်ယင် အဲဒီ ပုို့စ်အတုိုင်း (A) ဆုိုဒ်ကဟာပဲ လာပြစေချင်ပါတယ်။ အဲဒါ ကုို .htaccess မှာ post တခုုစီကုို redirect လုုပ်ယင် အဆင်ပြေပါ့မလား။ တခြား ဘာ fault တွေများရှိနုိုင်မလဲ ။ အဲထက်ကောင်းတဲ့အကြံဉာဏ်များ ရှိယင် သိချင်လိုု့ပါ။

Leave a comment


*