en易优Cms-演示站

您的位置: Home News Single page

For different servers and virtual spaces, the environment for running PHP is also different, currently mainly divided into: Nginx, apache, IIS and other servers. Here's how to remove the index. PHP character from the URL. Remember to restart the server and clear the cache in the management background.

[IIS Server]

There is a web. config file in the root directory of the website. The function of this file is to rewrite the URL, make the URL short, easy to optimize by SEO, and the user's memory. Open the web. config file and add the following code fragments on the original basis.

<rewrite>

<rules>

<rule name= "Imported Rule 1" enabled= "true" stopProcessing= "true">

<match url="^(. *)$"/>

<conditions logicalGrouping="MatchAll">

<add input="{HTTP_HOST}" pattern="^(. *)$"/>"

<add input="{REQUEST_FILENAME}" matchType= "IsFile" negate= "true"/>

<add input="{REQUEST_FILENAME}" matchType= "IsDirectory" negate= "true"/>

</conditions>

<action type="Rewrite" url="index.php/{R:1}"/>

</rule>

</rules>

</rewrite>

The following is the effect of a Hong Kong virtual space:

<? XML version = "1.0" encoding = "UTF-8"?>

<configuration>

<system.webServer>

<handlers>

<remove name="PHP-7.0-7i24.com"/>

<remove name="PHP-5.6-7i24.com"/>

<remove name="PHP-5.5-7i24.com"/>

<remove name="PHP-5.4-7i24.com"/>

<remove name="PHP-5.3-7i24.com"/>

<remove name="PHP-5.2-7i24.com"/>

<add name="PHP-5.4-7i24.com" path="*.php" verb="*" modules="FastCgiModule" scriptProcessor="c:php.4php-cgi.exe" resourceType="Either"/>

</handlers>

<rewrite>

<rules>

<rule name= "Imported Rule 1" enabled= "true" stopProcessing= "true">

<match url="^(. *)$"/>

<conditions logicalGrouping="MatchAll">

<add input="{HTTP_HOST}" pattern="^(. *)$"/>"

<add input="{REQUEST_FILENAME}" matchType= "IsFile" negate= "true"/>

<add input="{REQUEST_FILENAME}" matchType= "IsDirectory" negate= "true"/>

</conditions>

<action type="Rewrite" url="index.php/{R:1}"/>

</rule>

</rules>

</rewrite>

</system.webServer>

</configuration>

[Nginx Server]

Add the following code fragments to the original nginx rewrite file:

Location / {

If (!-e $request_filename) {

Rewrite ^(. *)$/ index. php? S=/$1 last;

Break;

}

}

[apache server]

Yiyou CMS automatically hides index. PHP entries by default in Apache server environment.

If no hiding is found, you can check whether the root directory. htaccess contains the following code snippets:

<IfModule mod_rewrite.c>

Options + FollowSymlinks - Multiviews

RewriteEngine on

RewriteCond%{REQUEST_FILENAME}!-d

RewriteCond%{REQUEST_FILENAME}!-f

RewriteRule ^(*)$index.php/$1 [QSA, PT, L]

</IfModule>

If it exists, go ahead and see if Apache has opened the URL rewrite_module and restart the service.


Beijing Huijia Private School. Copyright © 1993-2019.All Rights Reserved 京ICP备12037767号-3 地图