about 5 months ago - No comments
เคยเขียนการทำ list ไฟล์ด้วย apache modindexoptions มาแล้วแต่ติดปัญหาเรื่อง icons ที่ไม่ได้เอามาตามที่เราต้องการกลับไปเอา icon ซึ่งเป็น default ของ apache มาทำให้ index list มองแล้วไม่สวยดังใจ เลยมาเขียน .htaccess เพื่อให้เปลี่ยนที่อยู่ของ icons ให้ไปตามที่เราต้องการ
สำหรับใครที่ต้องการ icons ต่างๆ สามารถหาโหลดได้ทั่วไปแต่หากว่าไม่อยากโหลดมาก็สามารถเอาของผมไปใช้ได้ครับ สำหรับการ overide ตามนี้เลยครับ ส่วนนี้จะอยู่ใน .htaccess นะครับ
AddIconByEncoding (CMP,/index-style/icons/compressed.gif) x-compress x-gzip
#AddIconByType (TXT,/index-style/icons/text.gif) text/*
AddIconByType (IMG,/index-style/icons/image2.gif) image/*
AddIconByType (SND,/index-style/icons/sound2.gif) audio/*
AddIconByType (VID,/index-style/icons/video.png) video/*
AddIcon /index-style/icons/back.gif ..
AddIcon /index-style/icons/pdf.png .pdf
AddIcon /index-style/icons/html.png .html .xhtml .xml
AddIcon /index-style/icons/html.png .txt
AddIcon /index-style/icons/compressed.gif .rar .zip
AddIcon [...]
about 6 months ago - 2 comments
ห่างหายไปนานเลยกับการเขียนบล๊อกวันนี้มาอัพเดดหน่อย สำหรับตัวนี้จะเป็นการใช้งานของ apache IndexOptions ซึ่งจะเป็นการทำให้ folder เราสามารถ list ไฟล์ต่างๆ ได้เลย โดยการเขียนจะใช้งาน .htaccess เพื่อกำหนดค่าต่างๆ ครับ
วิธีการทำ
1. เริ่มแรกเลยไปยัง folder ที่ต้องการทำ index จากนั้นให้สร้างไฟล์ .htaccess แล้วเพิ่มโค้ดข้างล่างนี้
Options Indexes FollowSymLinks
IndexOptions FancyIndexing
IndexOptions VersionSort
IndexOptions HTMLTable
IndexOptions FoldersFirst
IndexOptions IconsAreLinks
IndexOptions IgnoreCase
IndexOptions SuppressDescription
IndexOptions SuppressHTMLPreamble
IndexOptions XHTML
IndexOptions IconWidth=16
IndexOptions IconHeight=16
IndexOptions NameWidth=*
IndexOrderDefault Descending Name
HeaderName /index-style/header.html
ReadmeName /index-style/footer.html
2. ให้ไปโหลดไฟล์ที่ http://recurser.com/articles/2008/12/29/styling-apache-directory-listings-with-mod_autoindex/ เพื่อทำให้สวยงามโดยการนำเอาไฟล์ไปไว้ที่ /index-style ก็จะได้รูปแบบสวยๆ แล้ว
เพิ่มเติม
http://recurser.com/articles/2008/12/29/styling-apache-directory-listings-with-mod_autoindex/
about 1 year ago - No comments
สวัสดีครับสำหรับวันนี้เมื่อผมต้องการเขียน php บน mac เนี่ยผมต้องทำอย่างไรครับสำหรับที่จริงแล้วเรามีทางเลือกได้หลายทางครับ จะเอาที่มีเป็น package อยู่แล้วมา install หรือนั่ง compile apache ใหม่ก็แล้วแต่ครับ สำหรับวิธีที่ผมเลือกคือเลือกที่จะใช้ apache ที่มีอยู่ใน 10.5.x อยู่แล้วครับ สำหรับใครที่อยากจะลงโดยไม่ต้องยุ่งกับอะไรสามารถเลือก MAMP, XAMPP or Marc Liyanage ได้ครับ สำหรับใครที่ต้องการใช้ที่ติดกับ mac อยู่แล้วก็ตามมาเลยครับ
Enable Developer Tools
คือการเปิดสิทธิให้สามารถใช้ root user ได้ เพื่อไม่ให้เกิดปัญหาเรื่องการใช้งานในการ access file permission สำหรับวิธีการให้ไปที่ Menu ->Go ->Utilities-> Directory Utility จากนั้นให้ทำการเลือก ปลดล็อกไฟล์ตรงรูปกุญแจแล้วจะมีการ Authenticate เพื่อตรวจสอบสิทธิการใช้ ให้เราใส่ password ลงไป หลังจากนั้นให้ไปที่ menu->edit->enable root users จะมีการถามพาสเวิร์ดให้เราใส่ password ของ [...]