phpStudy开启Apache重写模块(开启伪静态)
phpStudy开启Apache重写模块(开启伪静态)

扫描二维码访问该页面

6年前 网站建设 0 12024

pbootcms开启伪静态后地址栏不再包含 index.php,开启步骤如下:

一、IIS环境:
1、安装rewrite组件;
2、修改程序config/config.php文件 url_type=2
3、在站点目录建立web.config文件(默认已有,去除后缀bak即可),规则如下;
<rewrite>
   <rules>
       <rule name="reIndex" stopProcessing="true">
           <match url="^(.*)$" ignoreCase="true" />
               <conditions logicalGrouping="MatchAll">
                  <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                  <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
               </conditions>
               <action type="Rewrite" url="index.php/{R:1}" appendQueryString="true" />
       </rule>
   </rules>
</rewrite>

二、Apache环境:
1、开启Apache重写模块,具体请百度;
2、修改程序config/config.php文件 url_type=2
3、在站点目录建立.htaccess文件(默认已有),内容如下:
<IfModule mod_rewrite.c>
   Options +FollowSymlinks
   RewriteEngine On
       
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteCond %{REQUEST_FILENAME} !-f
  
   #如果页面出现"No input file specified." 请注释第一条,启用第二条
   RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
   #RewriteRule ^(.*)$ index.php [E=PATH_INFO:$1,QSA,PT,L]  
</IfModule>

学习笔记

PHPStudy开启rewrite_module重写功能启用.htaccess

1、开启rewrite_module

鼠标左键点击PHPStudy的 其他选项菜单,在PHP扩展及设置->Apache模块找到rewrite_module,点击即开启本模块。PHPStudy会自动重启服务。

 

2、修改httpd.conf文件

在 其他选项菜单->打开配置文件->httpd.conf,点击即可打开httpd.conf文件。

找到:

AllowOverride None

修改为:

AllowOverride All

然后重启PHPStudy的所有服务。 

0

发表评论

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。