<tr id="60f55"><track id="60f55"><delect id="60f55"></delect></track></tr>
    1. <tr id="60f55"></tr>

      歡迎進入浙江銀聚鋼業有限公司官方網站!

      咨詢熱線:18324224880

      首頁 > 聯系我們

      針對不同服務器、虛擬空間,運行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服務器】
      易優CMS在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 , 然后重啟服務就行了。


      亚洲AV中文无码乱人伦_亚洲欧洲中文日韩AV乱码_亚洲精品第一国产综合野草社区_播放