西部数码虚拟主机支持thinkphp的/public/访问
2022-07-28 14:14:58
348
{{single.collect_count}}

西部数码的虚拟主机站点都是默认的wwwroot目录,虚拟主机的默认跟目录是无法修改的。
但是thinkphp程序部分程序在开发的时候没有调整对应的程序入口,就需要网站访问默认指向到Public目录。
为了使用网站可以正常访问,可以在网站根目录下添加相应的伪静态规则,将对应的访问直接调整到Public目录

apache下伪静态规则:

 
  1. <IfModule mod_rewrite.c>
  2. RewriteEngine on
  3. RewriteCond %{REQUEST_URI} !^/public/
  4. RewriteRule ^(.*)$ /public/$1 [L]
  5. </IfModule>

IIS7下伪静态规则:

 
  1. <rules>
  2. <rule name="public" stopProcessing="true">
  3. <match url="^(.*)$" ignoreCase="false" />
  4. <conditions logicalGrouping="MatchAll">
  5. <add input="{URL}" pattern="^/public/" ignoreCase="false" negate="true" />
  6. </conditions>
  7. <action type="Rewrite" url="/public/{R:1}" />
  8. </rule>
  9. </rules>
回帖
全部回帖({{commentCount}})
{{item.user.nickname}} {{item.user.group_title}} {{item.friend_time}}
{{item.content}}
{{item.comment_content_show ? '取消' : '回复'}} 删除
回帖
{{reply.user.nickname}} {{reply.user.group_title}} {{reply.friend_time}}
{{reply.content}}
{{reply.comment_content_show ? '取消' : '回复'}} 删除
回帖
收起
没有更多啦~
{{commentLoading ? '加载中...' : '查看更多评论'}}