作者alpe (薛丁格的貓)
看板Web_Design
標題Re: [問題] RewriteRule
時間Thu Sep 5 19:34:57 2013
※ 引述《LaPass (LaPass)》之銘言:
: 目前網站的根目錄是長這樣
: /
: function 資料夾
: administrator 資料夾
: index.php
: view.php
: http://127.0.0.1/administrator => http://127.0.0.1/administrator
: 如果是我允許使用者連進去的資料夾,就不管他,直接連進去
: http://127.0.0.1/abc => http://127.0.0.1/view.php?id=abc
: http://127.0.0.1/abc/v => http://127.0.0.1/view.php?id=abc$mod=v
: http://127.0.0.1/function => http://127.0.0.1/view.php?id=function
RewriteEngine On
RewriteBase /
RewriteRule ^administrator/?.*$ [L]
RewriteRule ^([0-9a-zA-Z]+)$ view.php?id=$1 [L]
RewriteRule ^([0-9a-zA-Z]+)/([0-9a-zA-Z]+)$ view.php?id=$1&mod=$2 [L]
http://martinmelin.se/rewrite-rule-tester/
測過看起來OK.
--
Live Long and Prosper
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 61.31.105.62
推 LaPass:非常感謝,你提供的那個網站在測試時很實用 m(_ _)m 09/05 20:00
推 LaPass:RewriteRule ^(administrator(/.*)?)$ $1 [L] 09/06 01:15
→ LaPass:上面那一行最後我實際跑的時候是改成這樣,再次感謝原po 09/06 01:16