我現在htaccess文件包含mod_rewrite的規則來執行這樣的:座到PHP直接訪問文件
www.mysite.com/articles/jkr/harrypotter --> www.mysite.com/index.php?p=articles&author=jkr&book=harrypotter
www.mysite.com/articles/jkr --> www.mysite.com/index.php?p=articles&author=jkr
www.mysite.com/articles --> www.mysite.com/index.php?p=articles
在我的根目錄下,我有一些PHP文件,如:的index.php,pre.php,view.php等。
我想要什麼:阻止直接訪問php文件。
如:
www.mysite.com/index.php --> "404 - Page Not Found" or "File not exist"
www.mysite.com/view.php --> "404 - Page Not Found" or "File not exist"
我已經試過,我上搜索發現了一個碼。它使用「f」標誌。但我不明白這一點。當我使用它時,也不顯示主頁。所以,我刪除了我正在測試的所有內容。我的htaccess文件現在只包含三條規則(接受頁面,作者,書籍)。
請幫助。
對不起,我找到了解決辦法:http://stackoverflow.com/questions/1055652/mod-rewrite-error-404-if-php – 2012-01-11 08:57:03