腾讯云优惠券

呆错短视频系统(伪静态环境)配置教程

人气:710 更新:2022-08-04
呆错短视频系统伪静态环境配置教程,可以通过URL重写隐藏应用的入口文件index.php,配置虚拟主机或服务器的伪静态组件(rewrite),以下为各种WebServer对应的模块说明、如果是BT控制面板可以直接选择thinkphp5的伪静态规则。

[ NGINX]
在Nginx低版本中,是不支持PATHINFO的,但是可以通过在Nginx.conf中配置转发规则实现,将Nginx的伪静态规则文件(nginx.conf)里面的代码复制到网站配置的 location /{.....}中间 需要重启nginx才会生效

location / {
    if (!-e $request_filename) {
        rewrite ^(.*)$ /index.php?s=/$1 last;
        break;
    }
}

[ Apache ]

  • Apache的伪静态规则已经在网站根目录.htaccess,只需要开启Apache的Rewire模块
  • httpd.conf配置文件中加载了mod_rewrite.so模块
  • AllowOverride None 将None改为 All
  • 将Apache的伪静态规则文件(.htaccess )放到index.php的同级目录即可(默认已放置好)
<IfModule mod_rewrite.c>
Options +FollowSymlinks -Multiviews
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?s=$1 [QSA,PT,L]
</IfModule>

[ IIS ]
在IIS的高版本下面可以配置web.Config,在中间添加rewrite节点,将IIS的伪静态规则文件(iis7.Config)文件放到index.php的同级目录或在中间添加rewrite节点:

<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>