作者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
1F:推 LaPass:非常感谢,你提供的那个网站在测试时很实用 m(_ _)m 09/05 20:00
2F:推 LaPass:RewriteRule ^(administrator(/.*)?)$ $1 [L] 09/06 01:15
3F:→ LaPass:上面那一行最後我实际跑的时候是改成这样,再次感谢原po 09/06 01:16