Artificial Intelligence Programming Lab(AIPLab) 討論區

Please login or register.

請輸入帳號, 密碼以及預計登入時間

新聞:

[慶賀]恭喜亞大獲《泰晤士報》亞洲最佳大學排名第83名,國內排名第十名-20170201

作者 主題: Apache mod_rewrite Introduction  (閱讀 930 次)

admin

  • 管理員
  • Hero Member
  • *****
  • 文章: 1839
    • 檢視個人資料
Apache mod_rewrite Introduction
« 於: 三月 19, 2016, 03:10:02 am »
https://httpd.apache.org/docs/current/rewrite/intro.html

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?lang=$1 [L,QSA]

%{REQUEST_FILENAME} The full local filesystem path to the file or script matching the request,

a '!' character (exclamation mark) to negate the result of the condition
-f Is regular file.
-d Is directory.
[PT] The target (or substitution string) in a RewriteRule is assumed to be a file path, by default. The use of the [PT] flag causes it to be treated as a URI instead.
[L] flag causes mod_rewrite to stop processing the rule set.
[QSA] When the replacement URI contains a query string, the default behavior of RewriteRule is to discard the existing query string, and replace it with the newly generated one. Using the [QSA] flag causes the query strings to be combined.
已記錄
 

SimplePortal Classic 2.0.5