<li id="r4pfo"></li>

    <td id="r4pfo"></td>

    <table id="r4pfo"><option id="r4pfo"></option></table>
  1. <track id="r4pfo"><strike id="r4pfo"></strike></track>

    <object id="r4pfo"></object>
  2. ss針對不同服務器、虛擬空間,運行PHP的環境也有所不同,目前主要分為:Nginx、apache、IIS以及其他服務器。下面分享如何去掉URL上的index.php字符,記得最后要重啟服務器,在管理后臺清除緩存哦!
     
    【IIS服務器】
    在網站根目錄下有個 web.config 文件,這個文件的作用是重寫URL,讓URL變得簡短,易于SEO優化,以及用戶的記憶。打開 web.config 文件,在原有的基礎上加以下代碼片段即可。
    <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>
     
    以下是某個香港虛擬空間的效果:
    <?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服務器】
    在原有的nginx重寫文件里新增以下代碼片段:
    location / {
    if (!-e $request_filename) {
    rewrite ^(.*)$ /index.php?s=/$1 last;
    break;
    }
    }
     
    【apache服務器】
    RHCMS在apache服務器環境默認自動隱藏index.php入口。
    如果發現沒隱藏,可以檢查根目錄.htaccess是否含有以下代碼段:
    <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>

    如果存在,繼續查看apache是否開啟了URL重寫模塊 rewrite_module , 然后重啟服務就行了。


    a片无码在线观看