How to hide the TP entry file in Ubuntu system

不言
Release: 2023-04-03 16:52:01
Original
2356 people have browsed it

这篇文章给大家介绍的内容是关于Ubuntu系统下如何来隐藏TP的入口文件,有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助。

按照thinkphp手册中来讲,apache服务器下,隐藏thinkphp入口文件有3步:
httpd.conf配置文件中加载了mod_rewrite.so模块
AllowOverride None 将None改为 All
把下面的内容保存为.htaccess文件放到应用入口文件的同级目录下:                                                          

mod_rewrite.c>
RewriteEngine
on
RewriteCond
%{REQUEST_FILENAME}
!-d
RewriteCond
%{REQUEST_FILENAME}
!-f
RewriteRule
^(.*)$
index.php/$1 [QSA,PT,L]
Copy after login

ps:前两项在apache配置文件中

但在实际操作中发现几个问题:
1.在ubuntu下没有httpd.conf配置文件,只有apache2.conf,据说前者是用户自定义配置文件

2.apache2.conf中没有mod_rewrite.so(windows中把配置文件中包含这行的代码注释去掉即可完成配置)

解决办法:
a.终端:a2enmod rewrite ,完成后重启服务器

b.做启动链接(下次启动自动加载)(我在执行时提醒说已经存在了):

ln -s /etc/apache2/mods-available/rewrite.load
/etc/apache2/mods-enabled/rewrite.load
Copy after login

相关文章推荐:

thinkphp框架分组:thinkphp获取满足条件的数据

PHP中常用的一些功能总结(归纳)

The above is the detailed content of How to hide the TP entry file in Ubuntu system. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!