In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces the knowledge of "how to hide index.php files in ThinkPHP". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Take Apache as an example, you need to add the .htaccess file at the same level of the entry file (it comes with the official default), as follows:
Options + FollowSymlinks-MultiviewsRewriteEngine onRewriteCond% {REQUEST_FILENAME}!-dRewriteCond% {REQUEST_FILENAME}!-fRewriteRule ^ (. *) $index.php/$1 [QSA,PT,L]
If you use phpstudy, the rules are as follows:
Options + FollowSymlinks-Multiviews RewriteEngine on RewriteCond% {REQUEST_FILENAME}!-d RewriteCond% {REQUEST_FILENAME}!-f RewriteRule ^ (. *) $index.php
If the index.php file is stored in public, the rules are as follows:
Options + FollowSymlinks-Multiviews RewriteEngine on RewriteCond% {REQUEST_FILENAME}!-d RewriteCond% {REQUEST_FILENAME}!-f RewriteRule ^ (. *) $public/index.php
Next, you can access it using the following URL address
Http://tp5.com/index/index/indexhttp://tp5.com/index/index/hello
If the version of apache you are using does not properly hide index.php using the above method, try configuring the .htaccess file in the following way:
Options + FollowSymlinks-MultiviewsRewriteEngine onRewriteCond% {REQUEST_FILENAME}!-dRewriteCond% {REQUEST_FILENAME}!-fRewriteRule ^ (. *) $index.php?/$1 [QSA,PT,L]
If it is a Nginx environment, you can add to Nginx.conf:
Location / {/ /... .. Omit part of the code if (!-e $request_filename) {rewrite ^ (. *) $/ index.php?s=/$1 last; break;}} vhosts-confserver {listen 80; server_name xhb.com www.xhb.com; root "F:/project/xhb"; location / {index index.html index.htm index.php If (!-e $request_filename) {rewrite ^ (. *) $/ index.php?s=/$1 last; break;} # autoindex on;} location ~\ .php (. *) ${fastcgi_pass 127.0.0.1 rewrite 9000; fastcgi_index index.php Fastcgi_split_path_info ^ ((? U). +\ .php) (/?. +) $; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; include fastcgi_params;}}
This is the end of the content of "how to hide index.php files in ThinkPHP". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.