มาทำ Mod_Rewrite ใน SMF แบบง่ายๆ ครับ

เริ่มโดย Reality, 05 มกราคม 2010, 12:23:09

หัวข้อก่อนหน้า - หัวข้อถัดไป

0 สมาชิก และ 1 ผู้มาเยือน กำลังดูหัวข้อนี้

Putter™

อ้างถึงจาก: Luscentz ใน 06 มกราคม 2010, 00:17:46
ขอบคุณที่ช่วยหนุนคับ น้องรัก

พี่นึกว่าจะแป๊กซะแล้ว :wanwan004:


ตัวอย่างดูได้ที่ -> http://www.ruk-com.in.th/ นะครับ ท่านจะลองตั้งกระทู้ทดสอบก็แล้วแต่ครับ น้องผมบอกว่าเปิดให้ทดสอบเต็มที่ :wanwan002:


ผมไปบอกตอนไหมหว่า  :P :P
[direct=https://hostings.ruk-com.in.th]Ruk-Com Hosting (IAAS)[/direct]
[direct=https://ruk-com.cloud]Ruk-Com Cloud (PAAS)[/direct]
รีวิวโฮสติ่ง Ruk-Com  จากสมาชิก THAISEO

ไม่พอใจยินดีคืนเงินเต็มจำนวนทุกบริการ

expertduck

อ้างถึงจาก: Luscentz ใน 06 มกราคม 2010, 00:19:32
อ้างถึงจาก: expertduck ใน 06 มกราคม 2010, 00:16:59
แจ่มครับ  :wanwan016:

ปล. $url =  preg_replace('/[^a-z0-9ก-ฯ\-]*/si','-',$url); :wanwan020:


ขอบคุณครับ

อันนี้ท่านหมายถึงใช้ output buffering สุดท้ายมาใช้ใช่ไหมครับ


ผมไม่รู้ว่าความเร็วมันจะต่างกันไหมเนี้ยสิ :P
อ่าครับ คือหมายถึง replace ลิ้งค์อ่าครับ ให้เหลือเฉพาะ a-z 0-9 ตัวอักษรไทย และ - (Hyphen) ผมว่าน่าจะครอบคลุมกว่า เจาะจงไปเฉพาะ ตัวนั้นๆ
http://stackoverflow.com/questions/695438/safe-characters-for-friendly-url  :wanwan016: อันนี้ ตัวอักษรที่ปลอดภัย(ยังไงหว่า = =')

...ใส่ไรไม่ได้เลย อิอิ

nontavitz


Reality

อ้างถึงจาก: expertduck ใน 06 มกราคม 2010, 05:43:20
อ้างถึงจาก: Luscentz ใน 06 มกราคม 2010, 00:19:32
อ้างถึงจาก: expertduck ใน 06 มกราคม 2010, 00:16:59
แจ่มครับ  :wanwan016:

ปล. $url =  preg_replace('/[^a-z0-9ก-ฯ\-]*/si','-',$url); :wanwan020:


ขอบคุณครับ

อันนี้ท่านหมายถึงใช้ output buffering สุดท้ายมาใช้ใช่ไหมครับ


ผมไม่รู้ว่าความเร็วมันจะต่างกันไหมเนี้ยสิ :P
อ่าครับ คือหมายถึง replace ลิ้งค์อ่าครับ ให้เหลือเฉพาะ a-z 0-9 ตัวอักษรไทย และ - (Hyphen) ผมว่าน่าจะครอบคลุมกว่า เจาะจงไปเฉพาะ ตัวนั้นๆ
http://stackoverflow.com/questions/695438/safe-characters-for-friendly-url  :wanwan016: อันนี้ ตัวอักษรที่ปลอดภัย(ยังไงหว่า = =')


ขอบขุณอีกรอบครับ

แต่ผมใส่อินพุตเป็น abc มันรีเทิร์นมาเป็น -a-b-c- อ่าครับ ถ้ายังงี้ยังไม่ค่อยเวิร์คนะ(ผมว่า) :wanwan017:
ลองตัด - หน้าหลังแล้ว มันก็ยังติด - ระหว่างอักษณ จะตัดทั้งหมดเลยก็ไม่ดีบางทีบางอันมันเป็นช่องว่างก็น่าจะใส่ - ให้อ่านรู้เรื่อง
ละมั้งครับ :wanwan031:
*You walk right into reality, While my heart's still wild and free.. 

[direct=http://midnightadventure.net]Midnight Adventure[/direct]

expertduck

งั้นลองนอันนี้ครับ (อันนี้ผมใช้จริงในเว็บ SMF2 )
function strip_seo($txt)
{
   //By:ExpertDuck
   
   $txt = html_entity_decode($txt,ENT_QUOTES,'UTF-8');
   $txt = str_replace(' ','-',urldecode(strtolower($txt)));
   //strip
   $txt = preg_replace('~[/_\s]~','-',$txt);
   $txt = preg_replace('~[^a-z0-9ก-๙\-]~u','',$txt);
   //remove dup
   $txt = preg_replace('~-+~u','-',$txt);
   //first/last char
   $txt = preg_replace('~(^-)|(-$)~u','',$txt);
   $txt = htmlentities($txt,ENT_QUOTES,'UTF-8');
   return urlencode($txt);
}
...ใส่ไรไม่ได้เลย อิอิ

pizad_sura

อ้างถึงจาก: expertduck ใน 06 มกราคม 2010, 22:39:29
งั้นลองนอันนี้ครับ (อันนี้ผมใช้จริงในเว็บ SMF2 )
function strip_seo($txt)
{
   //By:ExpertDuck
   
   $txt = html_entity_decode($txt,ENT_QUOTES,'UTF-8');
   $txt = str_replace(' ','-',urldecode(strtolower($txt)));
   //strip
   $txt = preg_replace('~[/_\s]~','-',$txt);
   $txt = preg_replace('~[^a-z0-9ก-๙\-]~u','',$txt);
   //remove dup
   $txt = preg_replace('~-+~u','-',$txt);
   //first/last char
   $txt = preg_replace('~(^-)|(-$)~u','',$txt);
   $txt = htmlentities($txt,ENT_QUOTES,'UTF-8');
   return urlencode($txt);
}

smf 2.0 เหรอครับครับ

xvlnw.com

อ้างถึงผมแก้ที่ไฟล์ MessageIndex.php -> โดยการใส่
str_replace(array(' ', '#', '+', '?', '%'), array('-', '-', '-', '-', '-'), trim( -ตัวแปร- ))


ช่วยอธิบายวิธีการใส่ให้หน่อยนะครับ ว่าใส่ในส่วนไหนบ้าง บรรทัดที่เท่าไร อะไรประมาณนั้นครับ  เด็กใหม่ ยังหัดเล่นยู่ครับ
:wanwan031:
[direct=https://cloudhost.in.th/wordpress-hosting]ツ ⓌⓄⓇⒹⓅⓇⒺⓈⓈ ⒽⓄⓈⓉⒾⓃⒼ [/direct] :wanwan014:  :D
[direct=https://cloudhost.in.th/cloudhosting.html]Cloud Hosting[/direct] [direct=https://cloudhost.in.th/cloudvps.html]Cloud Server[/direct] [direct=https://cloudhost.in.th/vpshosting.html]Cloud VPS Hosting[/direct] [direct=https://cloudhost.in.th/windowsvps.html]Cloud Windows[/direct] Tel: 080-348-0843 LINE: ixvlnw

icegmza

ทำไมผมทำแล้ว ขึ้นอย่างนี้ครับบ

เว็บผมเข้าไม่ได้เลย siam2bot.com

ขึ้นอย่างนี้

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.


--------------------------------------------------------------------------------

Apache/2 Server at siam2bot.com Port 80

Hanuman


deknung

ทำแล้วบอร์ดจะเข้าไม่ได้อะคับ แต่ topic เข้าได้คับ งงมาก แก้มาตั้งนานแล้วคับ
[direct=http://www.jubpan.com//]จับแป้น[/direct][direct=http://www.jubpan.com/]บทความ[/direct][direct=http://www.jubpan.com/]คอมเม้นต์[/direct]

sawit

ขอเก็บไว้ก่อน ยังมึนอยู่  :wanwan011:

hotth

โอ้วๆถึงจะนานแล้วแต่ขอบอกว่าคุณหล่อมว้ากๆ