ยินดีต้อนรับคุณ, บุคคลทั่วไป กรุณา เข้าสู่ระบบ หรือ ลงทะเบียน

เข้าสู่ระบบด้วยชื่อผู้ใช้ รหัสผ่าน และระยะเวลาในเซสชั่น

หน้า: [1]   ลงล่าง
พิมพ์
ผู้เขียน หัวข้อ: URLภาษาไทย กับ Pligg  (อ่าน 8416 ครั้ง)
0 สมาชิก และ 1 บุคคลทั่วไป กำลังดูหัวข้อนี้
webdevils
สมุนแก๊งเสียว
*

พลังน้ำใจ: 63
ออฟไลน์ ออฟไลน์

กระทู้: 803



ดูรายละเอียด
« เมื่อ: 30 ตุลาคม 2008, 02:59:27 »

pligg นี้จะทำให้ url อ่านออกเป็นภาษาไทยนี้ทำยังไงหรอครับ ต้องแก้ที่ .htaccess ใช่ไหมครับ แล้วก็ title rss ของมันก้อ่านไม่ออก อ่านไทยไม่ได้ด้วยครับ พี่ๆช่วยผมหน่อยครับได้โปรด Cry



อันนี้ไฟล์ htaccess นะครับ


โค๊ด:
##### Gzip Begin #####
## To enable Gzip and decrease the load times of your Pligg site
## change /home/path/to to your absolute server path and remove the two # from both lines
## php_value auto_prepend_file /home/path/to/begin_gzip.php
## php_value auto_append_file /home/path/to/end_gzip.php

## AddType "text/javascript" .gz
## AddEncoding gzip .gz
## RewriteCond %{HTTP:Accept-encoding} gzip
## RewriteCond %{THE_REQUEST} ^(.*).js
## RewriteCond %{SCRIPT_FILENAME}.gz -f
## RewriteRule ^(.*)\.js $1.js.gz [L]
##### Gzip End #####

##### 404 Error Begin #####
## If Pligg is installed in a subfolder, change the below line to ErrorDocument 404 /name-of-subfolder/404error.php
ErrorDocument 404 /404error.php
##### 404 Error End #####

##### Re-directing Begin #####
Options +Indexes +FollowSymlinks -MultiViews
RewriteEngine on
## If Pligg is installed in a subfolder, change the below line to RewriteBase /name-of-subfolder
RewriteBase /
## If installed in a subfolder you may need to add ## to the beginning of the next line
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.php\ HTTP/

## Remove these two lines if you have a sub-domain like  http://ashdigg.pligg.com  or http://localhost
## Keep if your site it like   http://www.pligg.com
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^\/?(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
##### Re-directing End #####

##### You can find the below lines pre-made for you in the category management section of the admin panel ######
RewriteRule ^(all|pligg)/([^/]+)/?$ story.php?title=$2 [L]
RewriteRule ^(all|pligg)/?$ ?category=$1 [L]
#####

##### URL Method 2 ("Clean" URLs) Begin #####
RewriteRule ^story/([0-9]+)/?$ story.php?id=$1 [L]
RewriteRule ^story/title/([^/]+)/?$ story.php?title=$1 [L]
RewriteRule ^story/([0-9]+)/editcomment/([0-9]+)/?$ edit.php?id=$1&commentid=$2
RewriteRule ^story/([0-9]+)/edit/?$ editlink.php?id=$1
RewriteRule ^story/([0-9]+)/modify/([a-z]+)/?$ linkadmin.php?id=$1&action=$2
RewriteRule ^recommend/([a-zA-Z0-9-]+)/?$ recommend.php?id=$1 [L]
RewriteRule ^category/([^/]+)/?$ index.php?category=$1 [L]
RewriteRule ^upcoming/category/([^/]+)/?$ upcoming.php?category=$1 [L]
RewriteRule ^upcoming/([a-zA-Z0-9]+)/?$ upcoming.php?part=upcoming&order=$1
RewriteRule ^inbox/?$ user.php?view=inbox
RewriteRule ^user/?$ user.php
RewriteRule ^user/view/([a-zA-Z0-9-]+)/?$ user.php?view=$1
RewriteRule ^user/view/([a-zA-Z0-9+]+)/([a-zA-Z0-9+]+)/?$ user.php?view=$1&login=$2
RewriteRule ^user/view/([a-zA-Z0-9+]+)/login/([a-zA-Z0-9+]+)/?$ user.php?view=$1&login=$2
RewriteRule ^user/([a-zA-Z-]+)/link/([0-9+]+)/?$ user_add_remove_links.php?action=$1&link=$2
RewriteRule ^published/?$ index.php
RewriteRule ^published/([a-zA-Z0-9-]+)/?$ index.php?part=$1
RewriteRule ^published/([a-zA-Z0-9-]+)/category/([a-zA-Z0-9_-]+)/?$ index.php?part=$1&category=$2
RewriteRule ^upcoming/([a-zA-Z0-9-]+)/category/([a-zA-Z0-9_-]+)/?$ upcoming.php?part=upcoming&order=$1&category=$2
RewriteRule ^search/(.+)/?$ search.php?search=$1
RewriteRule ^searchurl/(.+)/?$ search.php?url=$1
RewriteRule ^login/?$ login.php
RewriteRule ^login/([a-zA-Z0-9-]+)/?$ login.php?return=$1
RewriteRule ^login/([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)/?$ login.php?return=$1/$2
RewriteRule ^register/?$ register.php
RewriteRule ^topusers/?$ topusers.php
RewriteRule ^about/([a-zA-Z0-9-]+)/?$ faq-$1.php
RewriteRule ^upcoming/?$ upcoming.php
RewriteRule ^submit/?$ submit.php
RewriteRule ^rss/?$ rss.php
RewriteRule ^rss/([a-zA-Z0-9-]+)/?$ rss.php?status=$1
RewriteRule ^rss/category/([a-zA-Z0-9_-]+)/?$ rss.php?category=$1
RewriteRule ^rss/search/([a-zA-Z0-9-]+)/?$ rss.php?search=$1
RewriteRule ^rss/user/([a-zA-Z0-9-]+)/?$ rss.php?user=$1
RewriteRule ^rss/user/([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)/?$ userrss.php?user=$1&status=$2
RewriteRule ^trackback/([0-9]+)/?$ trackback.php?id=$1
RewriteRule ^profile/?$ profile.php
RewriteRule ^admin/?$ admin_index.php
RewriteRule ^tagcloud/?$ cloud.php
RewriteRule ^tagcloud/range/([0-9]+)/?$ cloud.php?range=$1 [L]
RewriteRule ^tag/(.+)/(.+)/?$ search.php?search=$1&tag=true&from=$2 [QSA,NC,L]
RewriteRule ^tag/(.+)/?$ search.php?search=$1&tag=true [QSA,NC,L]
RewriteRule ^live/?$ live.php
RewriteRule ^out/([^/]+)/?$ out.php?title=$1 [L]
RewriteRule ^settemplate/?$ settemplate.php
RewriteRule ^comments/?$ live_comments.php
RewriteRule ^live_published/?$ live_published.php
RewriteRule ^unpublished/?$ live_unpublished.php
RewriteRule ^logout/([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)/?$ login.php?op=logout&return=$1/$2
RewriteRule ^published/page/([^/]+)/?$ index.php?page=$1 [L]
RewriteRule ^published/page/([^/]+)/category/([^/]+)/?$ index.php?page=$1&category=$2 [L]
RewriteRule ^published/page/([^/]+)/([^/]+)category/([^/]+)/?$ index.php?page=$1&part=$2&category=$3 [L]
RewriteRule ^upcoming/page/([0-9]+)/?$ upcoming.php?page=$1 [L]
RewriteRule ^upcoming/page/([^/]+)/category/([^/]+)/?$ upcoming.php?page=$1&category=$2 [L]
RewriteRule ^upcoming/page/([^/]+)/upcoming/([^/]+)/?$ upcoming.php?page=$1&part=upcoming&order=$2 [L]
RewriteRule ^upcoming/page/([^/]+)/upcoming=([^/]+)category/([^/]+)/?$ upcoming.php?page=$1&part=upcoming&order=$2&category=$3 [L]
RewriteRule ^topusers/page/([^/]+)/?$ topusers.php?page=$1 [L]
RewriteRule ^topusers/page/([^/]+)/sortby/([^/]+)?$ topusers.php?page=$1&sortby=$2 [L]
RewriteRule ^admin_links/page/([^/]+)/?$ admin_links.php?page=$1
RewriteRule ^admin_comments/page/([^/]+)/?$ admin_comments.php?page=$1
RewriteRule ^admin_users/page/([^/]+)/?$ admin_users.php?page=$1
RewriteRule ^comments/page/([^/]+)/?$ live_comments.php?page=$1 [L]
RewriteRule ^published/page/([^/]+)/?$ live_published.php?page=$1 [L]
RewriteRule ^unpublished/page/([^/]+)/?$ live_unpublished.php?page=$1 [L]
RewriteRule ^published/page/([^/]+)/([^/]+)/?$ index.php?page=$1&part=$2 [L]
RewriteRule ^published/page/([^/]+)/range/([^/]+)/?$ ?page=$1&range=$2 [L]
RewriteRule ^search/page/([^/]+)/search/([^/]+)/?$ search.php?page=$1&search=$2 [QSA,NC,L]
RewriteRule ^user/page/([^/]+)/([^/]+)/([^/]+)/?$ user.php?page=$1&view=$2&login=$3 [L]
RewriteRule ^statistics/page/([^/]+)/?$ module.php?module=pagestatistics&page=$1
RewriteRule ^view/([^/]+)/?$ admin_users.php?mode=view&user=$1
##### URL Method 2 ("Clean" URLs) End #####
« แก้ไขครั้งสุดท้าย: 30 ตุลาคม 2008, 03:02:00 โดย webdevils » บันทึกการเข้า

iday0
Verified Seller
สมุนแก๊งเสียว
*

พลังน้ำใจ: 73
ออฟไลน์ ออฟไลน์

กระทู้: 738



ดูรายละเอียด เว็บไซต์
« ตอบ #1 เมื่อ: 30 ตุลาคม 2008, 03:00:47 »

มารอคำตอบเหมือนกันครับ อิอิ
บันทึกการเข้า

webdevils
สมุนแก๊งเสียว
*

พลังน้ำใจ: 63
ออฟไลน์ ออฟไลน์

กระทู้: 803



ดูรายละเอียด
« ตอบ #2 เมื่อ: 30 ตุลาคม 2008, 03:08:31 »

ผมลองทำตามนี้แล้ว มันก็ัยังอ่านไทยไม่ออกเหมือนกันครับ http://forums.pligg.com/wiki-articles/8594-url-method.html
บันทึกการเข้า

webdevils
สมุนแก๊งเสียว
*

พลังน้ำใจ: 63
ออฟไลน์ ออฟไลน์

กระทู้: 803



ดูรายละเอียด
« ตอบ #3 เมื่อ: 30 ตุลาคม 2008, 19:02:13 »

พอมีคนทราบบ้างไหมครับ จะแก้ยังไง   ที่สำคัญrss มันขึ้นtitle เป็นภาษามั้วๆนี้แก้ครับ Cry Cry Cry
บันทึกการเข้า

บอท!
ยามว่าง
เจ้าพ่อบอร์ดเสียว
*

พลังน้ำใจ: 146
ออฟไลน์ ออฟไลน์

กระทู้: 7,517



ดูรายละเอียด
« ตอบ #4 เมื่อ: 30 ตุลาคม 2008, 19:18:58 »

ดัน ๆ อยากรู้ด้วย
วางแปลนว่าจะทำ
บันทึกการเข้า

/*SEO ทำอย่างไร สอนผมบ้างนะครับ*/
Original King is King of all King.
King who come to be Legend.
//all roads lead to rome
สารบัญ (Search Engine Optimization)
--= 10 ความเข้าใจผิดเกี่ยวกับ seo ----dr.k-------
ไม่มีอะไรจ๊ะ
net1
ก๊วนเสียว
*

พลังน้ำใจ: 17
ออฟไลน์ ออฟไลน์

กระทู้: 260



ดูรายละเอียด เว็บไซต์
« ตอบ #5 เมื่อ: 30 ตุลาคม 2008, 19:33:08 »

น่าจะต้องแก้ที่ตัวโปรแกรมให้สามารถรับค่าเป็น utf-8 ได้ หรือ สร้าง ลิงค์ให้เป็น utf-8
บันทึกการเข้า

ummimp
ก๊วนเสียว
*

พลังน้ำใจ: 17
ออฟไลน์ ออฟไลน์

กระทู้: 294



ดูรายละเอียด
« ตอบ #6 เมื่อ: 30 ตุลาคม 2008, 20:20:48 »

มีใครทำได้ ช่วยบอกด้วยครับ  Tongue
บันทึกการเข้า

flukenakrab
หัวหน้าแก๊งเสียว
*

พลังน้ำใจ: 110
ออฟไลน์ ออฟไลน์

กระทู้: 1,322



ดูรายละเอียด เว็บไซต์
« ตอบ #7 เมื่อ: 31 ตุลาคม 2008, 01:19:34 »

พอมีคนทราบบ้างไหมครับ จะแก้ยังไง   ที่สำคัญrss มันขึ้นtitle เป็นภาษามั้วๆนี้แก้ครับ Cry Cry Cry

rss ผมก็เป็นครับ  แต่ตรง url ไม่เป็นนะครับ
บันทึกการเข้า

movemore
เจ้าพ่อบอร์ดเสียว
*

พลังน้ำใจ: 174
ออฟไลน์ ออฟไลน์

กระทู้: 3,537



ดูรายละเอียด เว็บไซต์
« ตอบ #8 เมื่อ: 31 ตุลาคม 2008, 01:21:23 »

๐-ฮ
บันทึกการเข้า


จดโดเมน
.com .net .org แค่ 298 บาท ฟรี PRIVATE ทุกชื่อ ทุกโดเมน จ่ายผ่าน VISA / MASTERCARD ได้ทุกธนาคารครับ
จ่ายค่าบริการดอทสยามได้แล้วที่ 7-Eleven ทุกสาขา ทั่วประเทศ เป็นเจ้าของโดเมน100% เลือกดอทสยาม บริการออนไลน์เพื่อชีวิตที่ดีกว่า...
Premium VPS Network only 505Baht/month
EThaiZone
เจ้าพ่อโลลิค่อน
เจ้าพ่อบอร์ดเสียว
*

พลังน้ำใจ: 321
ออฟไลน์ ออฟไลน์

กระทู้: 12,516



ดูรายละเอียด
« ตอบ #9 เมื่อ: 31 ตุลาคม 2008, 02:01:48 »

๐-ฮ


มันต้อง ก-๙ ครับ

โค๊ด:
http://www.fileformat.info/info/unicode/block/thai/utf8test.htm

สำหรับ pligg งานนี้บอกเลยไ้ด้เลย มันยาว  Tongue
บันทึกการเข้า

janeos
ก๊วนเสียว
*

พลังน้ำใจ: 1
ออฟไลน์ ออฟไลน์

กระทู้: 265



ดูรายละเอียด
« ตอบ #10 เมื่อ: 24 พฤศจิกายน 2008, 13:27:49 »

อ้างถึง
pligg นี้จะทำให้ url อ่านออกเป็นภาษาไทยนี้ทำยังไงหรอครับ ต้องแก้ที่ .htaccess ใช่ไหมครับ


ชื่อ story พอทำเป็นภาษาไทยได้ครับ --> http://www.dunweb.net/
แต่ชื่อ category ผมก็กำลังหาวิธีอยู่เหมือนกัน แต่ยังติดอยู่ที่ .htaccess พอใส่ภาษาไทยลงไปแล้วมัน error อ่ะครับ Huh?
บันทึกการเข้า

บอท!
ยามว่าง
เจ้าพ่อบอร์ดเสียว
*

พลังน้ำใจ: 146
ออฟไลน์ ออฟไลน์

กระทู้: 7,517



ดูรายละเอียด
« ตอบ #11 เมื่อ: 24 พฤศจิกายน 2008, 14:08:56 »

ส่วน category ลองไปแก้ดูเมื่อกี้ ก็ใช้ ภาษาไทยได้นะ
ว่างแล้วค่อยไปเล่นเรื่อง rss feed
บันทึกการเข้า

/*SEO ทำอย่างไร สอนผมบ้างนะครับ*/
Original King is King of all King.
King who come to be Legend.
//all roads lead to rome
สารบัญ (Search Engine Optimization)
--= 10 ความเข้าใจผิดเกี่ยวกับ seo ----dr.k-------
ไม่มีอะไรจ๊ะ
ball6847
เจ้าพ่อบอร์ดเสียว
*

พลังน้ำใจ: 212
ออฟไลน์ ออฟไลน์

กระทู้: 4,174



ดูรายละเอียด
« ตอบ #12 เมื่อ: 24 พฤศจิกายน 2008, 14:49:05 »

บอลก็กำลังจะแกะ pligg เหมือนกัน

คิดว่าต้อง urlencode ภาษาไทยซะก่อน คงต้อลุยในสคริปท์เลย

edit : ดูมามันก็ encode ให้แล้วนี่หว่า  Grin
« แก้ไขครั้งสุดท้าย: 24 พฤศจิกายน 2008, 15:49:07 โดย ball6847 » บันทึกการเข้า

ball6847
เจ้าพ่อบอร์ดเสียว
*

พลังน้ำใจ: 212
ออฟไลน์ ออฟไลน์

กระทู้: 4,174



ดูรายละเอียด
« ตอบ #13 เมื่อ: 24 พฤศจิกายน 2008, 17:29:50 »

1. พอเพิ่มหมวดหมู่แล้วคนที่ใช้ URLMethod2 ต้องไปแก้ .htaccess ตามที่ pligg เจนให้ด้านล่าง อันนี้คิดว่าคนที่เล่นอยู่คงเข้าใจอยู่แล้ว (ผมเพิ่งลองก็ไม่เข้าใจ เหอๆ)

2. ปัญหาคือพอใช้หมวดหมู่ไทยก๊อปไปวาง .htaccess แล้วมันดันเน่า
- สาเหตุมันมาจาก RewriteRule ที่ pligg มันเจนมาให้นั้นมัน encode ภาษาไทยให้เสร็จสรรพ
แต่ผมไม่ทราบสาเหตุนะ ผมลองแก้ชื่อหมวดหมู่ให้เป็นแบบที่ไม่ได้เข้ารหัส มันดันได้ ไม่ทราบว่า apache มันเห็นเป็นแบบ encode หรือ decode แต่เครื่องผมมันเห็นแบบ decode

ทดสอบลองแก้ .htaccess จากที่ pligg มันเจนให้มา จะเห็นที่มันเข้ารหัสไว้ ลองแก้เป็นภาษาไทยแบบไม่เข้ารหัสเลย
อย่าง

โค๊ด:
RewriteRule ^(all|pligg|%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B9%8C%E0%B8%95%E0%B8%B9%E0%B8%99)/([^/]+)/?$ story.php?title=$2 [L]
RewriteRule ^(all|pligg|%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B9%8C%E0%B8%95%E0%B8%B9%E0%B8%99)/?$ ?category=$1 [L]


ก็แก้เป็น

โค๊ด:
RewriteRule ^(all|pligg|การ์ตูน)/([^/]+)/?$ story.php?title=$2 [L]
RewriteRule ^(all|pligg|การ์ตูน)/?$ ?category=$1 [L]


ทดสอบแล้วใน
- IE6 (ของโปรแกรม MultipleIE)
- IE7
- Firefox3
- Opera9
- Google Chrome


วิธีนี้มันดิบชะมัดเลยเหอๆ  Lips Sealed
- ผมไม่มีความรู้เรื่อง apache มากนะ เพราะฉะนั้นจะมีการตั้งค่าตรงไหนที่มีผลกับภาษาไทยใน .htaccess รึปล่าว ผมไม่ทราบ แต่เครื่อง localhost ผมผ่าน แล้วก็ยังไม่ได้ลองบน host จิง
- ผมใช้ editplus แก้ไฟล์ .htaccess เซฟเป็น utf-8 คนอื่นผมไม่ทราบนะว่าผลจะเป็นงัย



แต่อีกปัญหาน่าเบื่อเรื่อง encoding
ในบางเครื่องทำตามข้างบนก็อาจจะยังเน่า เพราะ pligg มันบันทึกลง database เน่าเอง

ถ้าบางคนมีปัญหากับ database ลอง ใส่ mysql_query("SET NAMES utf8;");
ในไฟล์ lib/db.php

แบบนี้มั้ง มั่วๆไป

โค๊ด:
<?php
function connect($dbuser=''$dbpassword=''$dbhost='localhost')
{
global $ezsql_mysql_str$return_val false;

// Must have a user and a password
if ( ! $dbuser )
{
$this->register_error($ezsql_mysql_str[1]);
//$this->show_errors ? trigger_error($ezsql_mysql_str[1],E_USER_WARNING) : null;
die($ezsql_mysql_str[1]);
}
// Try to establish the server database handle
else if ( ! $this->dbh = @mysql_connect($dbhost,$dbuser,$dbpassword,true) )
{
$this->register_error($ezsql_mysql_str[2].' in '.__FILE__.' on line '.__LINE__);
$this->show_errors trigger_error($ezsql_mysql_str[2],E_USER_WARNING) : null;
}
else
{
if($this->log_to_file){
$fh=fopen($this->logfile,"a");
fwrite($fh,"Connect - " date("Y-m-d H:i:s"time()) . " - " $_SERVER['REQUEST_URI'] ."\n");
fclose($fh);
}

$this->dbuser $dbuser;
$this->dbpassword $dbpassword;
$this->dbhost $dbhost;
$return_val true;

mysql_query("SET NAMES utf8;");

}

return $return_val;
}

?>

อ้อ ลืมบอกว่า ผมสร้าง db เป็น utf8 หมดนะ (ไม่รู้เกี่ยวป่าว โคตรมั่วๆๆๆๆๆ)


อีกเรื่องๆๆๆๆๆ ตอน submit url อ่ะ pligg มันจะไปดึงหน้าเว็บนั้นมาแล้วเอา title มากรอกให้เอง แล้วมันจะแปลง encoding ให้ด้วย ถ้าหน้านั้นไม่ใช้ UTF-8

แต่ ... บางเว็บใช้ 2 encoding ไม่ใกล้ไม่ไกล ไทยเสียวนี่เอง pligg มันเอาแค่อันแรก เลยกลายเป็นมันเอา UTF-8 ไปแปลงเป็น UTF-8 เหอๆ เอ๋อไปกันใหญ่ แต่ปัยหานี้ไม่น่าจะมีบ่อย ผ่านๆๆๆ

 Grin Angry

« แก้ไขครั้งสุดท้าย: 02 ธันวาคม 2008, 16:04:55 โดย ball6847 » บันทึกการเข้า

หน้า: [1]   ขึ้นบน
พิมพ์