CakePHP mod_rewrite note
原本 CakePHP 既 .htaccess 其實好霸道
將所有收到既 request 飛入 app/webroot/
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
有時要試野, 放個 phpinfo 都唔知放邊
最後睇左一輪 mod_rewrite
加左 2句
改成
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteRule ^$ app/webroot/ [L]
RewriteRule source/(.*) source/$1 [L]
RewriteRule test/(.*) test/$1 [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
/source folder 同/test folder 唔會飛入 app/webroot/
當然唔好同 CakePHP 既 controller 撞 la...
mod_rewrite note
(.*) 解任何字
^$ 未知點解
mod_rewrite tools
http://www.linkvendor.com/seo-tools/url-rewrite.html
http://www.webmaster-toolkit.com/mod_rewrite-rewriterule-generator.shtml
whatsapp spam
12 年前