You can hide the application's portal file index.php through URL rewriting, which is the configuration reference for the relevant server:
[Apache]
- The mod_rewrite.so module is loaded in the httpd.conf configuration file
- allowoverride None Change None to all
- Save the following content as a. htaccess file in the same sibling directory as the application portal file
<>< span=""> mod_rewrite . c > <>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
[IIS]
If your server environment supports Isapi_rewrite, you can configure the Httpd.ini file to add the following:
RewriteRule(.*)$ /index\.php\?s=$1 [I]
Under high versions of IIS, you can configure Web. config to add rewrite nodes in the middle:
<>< span=""> name = "OrgPage" stopProcessing = "true" > <>
<>< span=""> url = "^(.*)$" /> <>
<>< span=""> logicalGrouping = "MatchAll" > <>
input="{HTTP_HOST}"pattern="^(.*)$"/>
input="{REQUEST_FILENAME}"matchType="IsFile"negate="true"/>
input="{REQUEST_FILENAME}"matchType="IsDirectory"negate="true"/>
type="Rewrite"url="index.php/{R:1}"/>
[Nginx]
In Nginx low version, PathInfo is not supported, but can be implemented by configuring a forwarding rule in nginx.conf:
location /{// …..省略部分代码
if(!-e $request_filename){
rewrite ^(.*)$ /index.php?s=$1 last;
break;
}
}
In fact, the internal is forwarded to the thinkphp provided by the compatibility mode URL, in this way, you can solve other non-support PathInfo Web server environment.
If your thinkphp is installed in a level two directory, the Nginx pseudo-static method is set as follows, where Youdomain is the directory name in which it resides. Youdomain needs to be determined according to the directory index.php the entry file.
location /youdomain/{
if(!-e $request_filename){
rewrite ^/youdomain/(.*)$ /youdomain/index.php?s=$1 last;
}
}
The original Access URL:
http://serverName/index.php/模块/控制器/操作/[参数名/参数值...]
Once set, we can access it in the following ways:
http://serverName/模块/控制器/操作/[参数名/参数值...]
By default, the module in the URL address can not be omitted, if you need to simplify a module URL access address, you can set the module list and the default module or sub-domain name deployment to the module, refer to the following module and Domain name Deployment section.
The above describes the Thinkphp32url rewrite hidden application of the portal file indexphp, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.