ฉันมักจะใช้ไฟล์ htaccess นี้เพื่อลบ index.php ออกจาก URL ของฉันใน ExpressionEngine
AddType video/ogg .ogv
AddType video/mp4 .mp4
AddType video/webm .webm
AcceptPathInfo On
Options -Indexes
<IfModule mod_rewrite.c>
RewriteEngine On
Options +FollowSymLinks
# Looks for files and directories that do not exist
# and provide the segments to the index.php file
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^/index.php
RewriteCond $1 !.(css|js|png|jpe?g|gif|ico)$ [NC]
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
แม้ว่าวิธีนี้จะได้ผลดี แต่ก่อนที่เราจะย้ายไซต์นี้ไปสู่การใช้งานจริง เรากำลังเปลี่ยนเส้นทางการรับส่งข้อมูลทั้งหมดไปยัง URL ที่ระบุไปยังอีกไซต์หนึ่งผ่านไฟล์ htaccess นี้
RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_ADDR} !^127\.0\.0\.1
RewriteRule ^(.*)$ http://www.anotherdomain.com/ [R=301,NC]
ที่อยู่ IP ของฉันกำลังแทนที่การเรียก localhost เพื่อให้ฉันสามารถเข้าถึงไซต์ได้
โดยพื้นฐานแล้วสิ่งที่ฉันกำลังมองหาคือการรวมกันของ 2 อย่างนี้ที่จะลบ index.php ออกจาก URL ของฉันให้ฉัน แต่ยังคงเปลี่ยนเส้นทางคนอื่น ๆ
ขอบคุณสตีเว่น
REMOTE_ADDR
ให้กับการเขียนใหม่ข้างต้นล่ะ ฉันขาดอะไรบางอย่างไปหรือเปล่า? - person Kamil Šrot   schedule 18.11.2012