久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

如何使用 mod_rewrite 忽略對 php 文件的訪問?

How to ignore access to php files with mod_rewrite?(如何使用 mod_rewrite 忽略對 php 文件的訪問?)
本文介紹了如何使用 mod_rewrite 忽略對 php 文件的訪問?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

例如:www.example.com/about.php

For example: www.example.com/about.php

我不希望可以訪問擴展名為 .php 的文件,而是顯示 404 頁面.

I don't want the files with the extension .php to be available to reach, display a 404 page instead.

我在根文件夾中有文件:內容.php關于.php頁腳.php等等...現在我可以通過在地址欄中輸入來訪問這些文件.我想限制這個.

I have the files in the root folder: content.php about.php footer.php etc... Now i can reach these files by typing in to the adress bar. I want to restrict this.

我該怎么做?

推薦答案

避免 mod_rewrite 的開銷和復雜性的更好方法是簡單地不要將您不想通過 url 訪問的文件放在根文件夾中.您可以將它們放在其他地方并從那里包含它們;簡單且(更)安全,但出于某種原因,這似乎不是常識.

A better approach that avoids the overhead and complexity of mod_rewrite is to simply not put files you don't want reached by url in the root folder. You can just put them somewhere else and include them from there; simple and (more) secure, but for some reason this doesn't seem to be common knowledge.

一個示例結構可能是

project/
project/root
project/lib

您的公共代碼(例如 index.php)將位于項目/根目錄中,這將是網站根目錄.您包含的代碼將存在于 project/lib 中,可以使用 require、include 等輕松包含.

Your public code (e.g. index.php) would live in project/root, and that would be the website root. Your included code would live in project/lib can be easily included using require, include, etc.

沒有 mod_rewrite.很簡單.

No mod_rewrite. Very simple.

這篇關于如何使用 mod_rewrite 忽略對 php 文件的訪問?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Action View Helper in Zend - Work around?(Zend 中的動作視圖助手 - 解決方法?)
Is this a good way to match URI to class/method in PHP for MVC(這是將 URI 與 PHP 中用于 MVC 的類/方法匹配的好方法嗎)
Where do I save partial (views) in Zend Framework, to be accessible for all Views in my App?(我在哪里保存 Zend Framework 中的部分(視圖),以便我的應用程序中的所有視圖都可以訪問?) - IT屋-程序員軟件開發技術
Having a single entry point to a website. Bad? Good? Non-issue?(有一個網站的單一入口點.壞的?好的?沒問題?)
Is MVC + Service Layer common in zend or PHP?(MVC + 服務層在 Zend 或 PHP 中常見嗎?)
Hello World example in MVC approach to PHP(PHP MVC 方法中的 Hello World 示例)
主站蜘蛛池模板: 久久成人精品视频 | www.国产.com| 国产午夜精品久久久 | 三级黄色大片网站 | 亚洲 欧美 另类 日韩 | 成人午夜激情 | 91亚洲国产成人久久精品网站 | 毛片视频免费观看 | 一级欧美一级日韩片 | 成人影院av| caoporon| 亚洲精品视频免费观看 | 亚洲综合色站 | 青春草在线 | 亚洲二区在线 | 一级毛片色一级 | 亚洲精品久久久久久国产精华液 | 色屁屁在线观看 | 狠狠狠干| 日日夜夜精品视频 | 欧美日本韩国一区二区 | 国产一区二区免费 | 911精品国产 | 国产精品亚洲精品 | 激情五月激情综合网 | 久久中文一区二区 | 巨大荫蒂视频欧美另类大 | 国产网站在线免费观看 | 欧美成人精品一区二区男人看 | 韩日在线视频 | 国产精品伦理一区 | 婷婷丁香综合网 | 一区二区三区视频在线观看 | 福利视频一二区 | av免费网站在线 | 国产高清一区二区 | 国产美女网站 | 日本精品一区二区三区视频 | 欧洲精品码一区二区三区免费看 | 久久久久久国产精品免费免费男同 | aaaaaa大片免费看最大的 |