分享
  • 收藏
  • 举报
    X
    隐藏index.php倒底需要服务器支持什么东西
    632
    6

    有时跟家间服务商说不明白。人家就说你的是源码问题。

    7
    赏礼
    赏钱
    收藏
    点击回复
        全部留言
    • 6
    • 阿赖耶识 程序开发者 消费:24.43元 2018-05-15 20:32 20:326楼

      就是服务器要支持伪静态,现在服务商应该都支持的

      apache 是.htaccess 官方提供的就是这个文件

      iis6是 httpd.ini

      RewriteRule (.*)$ /index\.php\?s=$1 [I]

      iis7是 web.config

      <rewrite>
       <rules>
       <rule name="OrgPage" 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>

      nginx里nginx.conf加入:

        location / { // …..省略部分代码
         if (!-e $request_filename) {
         rewrite  ^(.*)$  /index.php?s=/$1  last;
         break;
          }
       }

      以上是tp5默认的,可以自己测试下是否有用。

      不知道什么情况,我用的必须上面的找个个规则,也就是tp5默认的,官方那个不行

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

      #  RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1]


    1 赏钱 赏礼回复
    • admin 超级管理员 消费:3.03元 2018-05-15 17:59 17:596楼

      IIS暂时没研究.


      apache的话,默认是支持,就是.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]

        RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1]

      </IfModule>


      verycong 消费:118.73元 2018-05-15 18:00

      这个内容不是程序默认就加了的。

      aaa999 消费:1371元 2018-05-15 20:16
      IIS可以安装 URL重写 导入这个
      aaa999 消费:1371元 2018-05-15 20:20

      这是我IIS安装 URL重写 后导入修改了下得到的这个 

      web.config  

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

      <configuration>

          <system.webServer>

              <rewrite>

                  <rules>

                      <rule name="已导入的规则 1" stopProcessing="true">

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

                          <conditions logicalGrouping="MatchAll">

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

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

                          </conditions>

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

                      </rule>

                  </rules>

              </rewrite>

              <httpErrors errorMode="Detailed" />

          </system.webServer>

      </configuration>


    0 赏钱 赏礼回复
    • thji2018 普通粉丝 消费:0元 2018-05-15 19:52 19:526楼

      为什么就不能提供像3月22日版的X1?当时安装,很顺利。更新后的X1,隐藏了index.php,导致一些不支持隐藏的用户安装不了。

    0 赏钱 赏礼回复
    更多回复
    恢复多功能编辑器
  • 3 1
  • 推荐内容
    扫一扫访问手机版
    请选择要切换的马甲:

     
    网页即时交流
    QQ咨询
    咨询热线
    020-28998648