httpd.conf
.htaccess
用上面的 rewrite rule 就可以將這個網址
http://example.com/cgi-bin/book.cgi?author=bowen&topic=apache
變成用這個網址來連線
http://example.com/book/bowen/apache
至於 httpd.conf 的 Options FollowSymLinks 就好像一定要設定, 不然會轉不過去 XD 然後要將設定寫在 .htaccess, 就要加 AllowOverride, 想要什麼東西都在 .htaccess 設定的話就設 All 囉!詳細的設定選項請看下列網址
http://httpd.apache.org/docs/2.0/mod/core.html#allowoverride
不過說真的, apache 的 document 可能是看不習慣, 有點難理解。說真的, mod_rewrite 滿難搞的 XD
memo:
把 rewriterule 寫在 httpd.conf, 跟 .htaccess 會有檔案路徑上的差異? 剛才在 try 的時候, 原本寫在 httpd.conf 的檔案路徑有 / (slash) 開頭, 而寫到 .htaccess 則要去掉 / (slash), 嗯~ 阿災, 繼續摸索中, 還有好多 flag 要看。
0 Comments until now
Add your Comment!