ขอความช่วยเหลือเรือง .htacess

เริ่มโดย EntServ, 23 สิงหาคม 2012, 22:27:39

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

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

EntServ

พอดีผมต้องการเขียนประมาณว่า

ถ้าที่ address  การเรียกแบบ http://www.xxxxxx.xxx/YYYYYY/ZZZZ.html ให้แสดงโดยใช้ไฟล์ shoedetail.php และให้เอาค่า YYYYY ไปเป็นตัวแปร a  และ ZZZZ ไปเป็นตัวแปร b
ในเว็บเดียวกัน ถ้ามีการเรียกแบบ http://www.xxxxxx.xxx/AAAAAA/ ให้แสดงโดยใช้ไฟล์ index.php แต่เก็บค่าตัวแปร AAAAA ใน a

ประมาณนี้อ่าครับ แต่ที่ทำตอนนี้ ยังไม่ได้แบบที่คิดเลย

<IfModule mod_php4.c>
   php_value session.use_trans_sid 0
</IfModule>
<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^ปปป\.com$ [NC]
RewriteRule ^(.*)$ http://www.ปปป.com/$1 [R=301,L]


ช่วยผมด้วยยยยยยยยยยยยยยยยยยยยยยยยยยย :wanwan031: :wanwan031: :wanwan031:
รับทำระบบ Streaming Server อยากได้เว็บสตรีมมิ่งหล่อๆ ติดต่อ PM ครับ

kungbest

RewriteRule ^(.*)/(.*)\.html$ shoedetail.php?a=$1&b=$2 [L]
RewriteRule ^(.*)/$ index.php?a=$1 [L]


เอาไปลองดูคับ  :wanwan020:

xvlnw.com

^
^
ตามด้านบนเลยครับ คิดว่าน่าจะได้นะ
[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

EntServ

อ้างถึงจาก: kungbest ใน 23 สิงหาคม 2012, 22:37:29
RewriteRule ^(.*)/(.*)\.html$ shoedetail.php?a=$1&b=$2 [L]
RewriteRule ^(.*)/$ index.php?a=$1 [L]


เอาไปลองดูคับ  :wanwan020:

แบบนี้ผมลองแล้วครับ มันมีปัญหาตรงพวกไฟล์ที่เรียกจาก /css/ หรือ /image/ เน่าหมดเลยอ่าครับ

มีวิธีแก้ไขไหมครับ
รับทำระบบ Streaming Server อยากได้เว็บสตรีมมิ่งหล่อๆ ติดต่อ PM ครับ

EntServ

อ้างถึงจาก: kungbest ใน 23 สิงหาคม 2012, 22:37:29
RewriteRule ^(.*)/(.*)\.html$ shoedetail.php?a=$1&b=$2 [L]
RewriteRule ^(.*)/$ index.php?a=$1 [L]


เอาไปลองดูคับ  :wanwan020:
52 ----> 53
รับทำระบบ Streaming Server อยากได้เว็บสตรีมมิ่งหล่อๆ ติดต่อ PM ครับ

xvlnw.com

[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

EntServ

รับทำระบบ Streaming Server อยากได้เว็บสตรีมมิ่งหล่อๆ ติดต่อ PM ครับ

ball6847


<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule . - [L]

# Rule ต่างๆ ค่อยตามมา


</IfModule>


mod_rewrite ควรจะมีโค้ดด้านบนไว้ เพื่อให้ไฟล์หรือ directory ที่มีจริง ไม่ถูกเปลี่ยนไปด้วย
ตอนเขียนโค้ด html ที่ออกมา ควรใช้การอ้างอิงไฟล์ทั้งหมด (href , src , link) เป็น url เต็ม (ตั้งแต่ http://) ไม่งั้นมาแก้ mod_rewrite ทีหลัง งานจะเกิด
We use Ubuntu.

[direct=http://ng-seo.sourcelab.xyz/]AngularJS SEO Experimental[/direct]

nuijung

รบกวนถามทีคะ

http://www.aa.com/myservice.php?a=1
ต้องการให้มันแสดง
http://www.aa.com/บริการของเรา/1


Options +FollowSymlinks
RewriteEngine on
RewriteRule ^บริการของเรา/([0-9][0-9])\.html$ myservice.php?a=$1 [L]


แล้วมันไม่ขึ้นอะจ๊ะรบกวนสอบถามผู้รู้ทีคะ