Mod Rewrite ใน localhost ใครเคยทำรบกวนสอนหน่อยครับ

เริ่มโดย tkcomsci, 10 กรกฎาคม 2013, 14:41:22

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

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

tkcomsci

 :wanwan023:

# enable apache morRewrite module #
RewriteEngine on

RewriteBase /

# set files headers
<IfModule mod_headers.c>
<FilesMatch "\.(css|js|png|gif|jpg|jpeg|htc)$">
Header set Cache-Control "max-age=2678400, public, must-revalidate"
</FilesMatch>
</IfModule>

# deflate static content
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/x-component text/css application/x-javascript application/javascript
</IfModule>

# allow request methods
<Limit POST PUT DELETE GET OPTIONS HEAD>
   Order deny,allow
   Allow from All
</Limit>

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f

ErrorDocument 404 /404.html

# define system languages
RewriteRule ^([^//]+)/?(.{2})?/$ index.php?page=$1 [QSA,L]

# define paging
RewriteRule ^([^//]+)/?(.*)?/index([0-9]*).ht(m?ml?)$ index.php?page=$1&rlVareables=$2&pg=$3 [QSA,L]

# define listing
RewriteRule ^([^/][\w\-\_]+)(.+)-l?([0-9]+).ht(m|ml)$ index.php?page=$1&rlVareables=$2&listing_id=$3 [QSA,L]

# define account details request
RewriteRule ^((\w{2})/)?([\w-_]{3,})$ index.php?page=$3&lang=$2&account_request [QSA,L]

# define single pages
RewriteRule ^([^//]+)/?(^/*)?.ht(m?ml?)$ index.php?page=$1 [QSA,L]

# define other pages
RewriteRule ^([^//]+)/?(.*)?/?(.*)?(.ht(m?ml?)|/+)$ index.php?page=$1&rlVareables=$2 [QSA,L]



จากโค๊ดด้านบน ทำไง ให้รัน ใน เครื่องจำลองได้ครับ มันมี part ไฟล์ ด้วยนะครับ

xvlnw.com

ก็โค๊ดปกติครับ รันที่ไหนก็ได้ครับ แค่เปิด mod_rewrite รันได้แล้วครับ
[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

zest_th

ถ้าใช้ appserv
ไปดูที่    C:\AppServ\Apache2.2\conf

เปิดไฟล์ httpd.conf ขึ้นมา
ค้นหาคำว่า rewrite_module modules

เอา # ข้างหน้าออกไป แล้ว save

จากนั้น restart apache

:wanwan013: :wanwan013:

ipostfree

อ้างถึงจาก: zest_th ใน 10 กรกฎาคม 2013, 15:31:28
ถ้าใช้ appserv
ไปดูที่    C:\AppServ\Apache2.2\conf

เปิดไฟล์ httpd.conf ขึ้นมา
ค้นหาคำว่า rewrite_module modules

เอา # ข้างหน้าออกไป แล้ว save

จากนั้น restart apache

:wanwan013: :wanwan013:

ตามนี้ครับ  :wanwan017: :wanwan017: :wanwan017:

xvlnw.com

restart apache ไม่หาย ก็ restart คอมซักทีนึง ก็จะใช้งานได้ปกติครับ
[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

xvlnw.com

เสริมครับ:

ถ้าใช้ Xampp ก็ไม่ต้องไปหาเปิดนะครับ มันเปิดมาให้อยู่แล้วครับ :)
[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


jthanet

หากคุณ เป็นนักคลิ๊ก คุณต้องดู เพราะแค่คลิ๊กก็ได้เงิน  ไม่ต้องลงทุน

http://nerdbuxclick.blogspot.com/

adidog

อ้างถึงจาก: Railway ใน 10 กรกฎาคม 2013, 15:45:31
RewriteBase /ชื่อโฟลเดอร์ด้วยครับ/

ไม่งั้นมันไป www อย่างเดียวเลย

ผมว่าตามนี้ครับ บางที mod มันทำงานแล้ว แต่เราดันลืมกำหนด rewritebase ให้มัน
Certain Dri [direct=http://www.ishiclub.com/]Certain Dri[/direct]
คุณแม่มือใหม่ [direct=http://www.mamyget.com/]คุณแม่มือใหม่[/direct]

tkcomsci

 :wanwan011:


ผมลืม คิดว่าเปิดแล้ว

ขอบคุณทุกคำตอบ นะ ครับ +1ให้ นะครับ