mod_rewrite 规则需要检查...安全吗?
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* index.php
这些是我的项目的 .htaccess 文件的代码行。 我只是想问一下是否有任何安全问题或您有什么具体意见 不使用这些线路,而是使用其他线路...
背景:我想使用我自己的小“管理系统”来使我的项目上线 这个系统自己处理每个 uri... 如果在文件系统上找不到特定的 uri 作为目录或文件,它应该重定向到我的 索引文件,因此系统可以显示主页或任何其他页面。
你怎么认为?
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* index.php
these are my code lines for my .htaccess file for an project of mine.
i just want to ask if there're any safety problems or any specific comment of yours
to not use these lines and instead use other lines...
background: i want to use my own little "management system" to get my project online
and this system handle every uri by itself...
if the specific uri not found on the filesystem as a dir or file it should redirect to my
index-file, so the system could instead show home- or any other page.
what do you think?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为你应该使用 ErrorDocument 而不是该行代码。
该行代码意味着如果请求真实目录(存在于服务器上)或现有文件,则不会提供index.php。
因此,如果没有找到文件或目录,页面将被index.php重写,而不是重定向,这意味着用户看到索引页面的内容。
如果您使用 ErrorDocument,用户就知道找不到该文件或目录。
背景:对不起我的英语
I think you should use ErrorDocument instead that lines code.
That lines code mean if request for an real directory ( exists on server) or an exitst file, index.php isn't served.
So if a file or directory is not founded, the page is rewrited by index.php, not redirect, it mean user see content of index page.
if you use ErrorDocument, user know that that file or directory is not found.
background: sorry about my engish