phpstudyV8安装thinkcmf提示rewrite伪静态不支持解决方法 php项目中需要使用伪静态打开网页进行本地测试

使用phpstudyV8安装thinkcmf提示rewrite伪静态不支持,解决方法

php项目中需要使用伪静态打开网页进行本地测试时,也可使用该方法解决

 找了很多方法都无效,这个方法管用,记录一下。
步骤一:

服务器部署好的程序需要在本地再做二开时在phpstudy里总是打不开后台,这时候一般都是伪静态的问题,在站点管理中选伪静态,然后填写对应的规则

     

 

我用的是thincmf,基于thinkphp的一个框架,填写这些就够了 

<IfModule mod_rewrite.c>
Options +FollowSymlinks -Multiviews
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^api/?(.*)$ api.php?s=$1 [QSA,PT,L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?s=$1 [QSA,PT,L]
</IfModule>

步骤二:

若步骤一方法无效,再使用步骤二

问题描述:
    安装thinkcmf的时候提示服务器rewrite没开启。也就是开启伪静态,url重写规则,它还可以限制特定ip访问的功能。
解决办法:

apache:

修改网站根目录的 .htaccess 文件 直接复制粘贴就可以

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>

如果你的apache是fastcgi 模式 那就改成下面这样。

如何查看apache是fastcgi工作模式?在phpstudy8客户端中找到设置--配置文件--httpd.config文件中查找fcgid_module。

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1]
</IfModule>

 

 

 

来源路径:https://blog.csdn.net/qq_40808374/article/details/119805572

posted @ 2023-12-05 10:33  Jweib  阅读(136)  评论(0编辑  收藏  举报