知识问答

如何开启Apache服务器伪静态

apache开启伪静态的步骤:

找到apache的配置文件httpd.conf,phpstudy路径是:phpstudy_proExtensionsApache2.4.39confhttpd.conf(版本不同灵活变动),每个环境部署软件路径不同。

找到

#LoadModulerewrite_modulemodules/mod_rewrite.so

把前面#去掉。没有则添加,但必选独占一行,使apache支持 mod_rewrite 模块。

httpd.conf中找到AllowOverride

把<Directory />里的 AllowOverride None 换成 AllowOverride All,使apache支持 .htaccess 文件(默认为“None”)

改好后的效果:

ServerNamelocalhost:80##Denyaccesstotheentiretyofyourserver'sfilesystem.Youmust#explicitlypermitaccesstowebcontentdirectoriesinother#<Directory>blocksbelow.#<Directory/>Options+Indexes+FollowSymLinks+ExecCGIAllowOverrideAllOrderallow,denyAllowfromallRequireallgranted</Directory>#

重启apache服务器

在要启用伪静态的 PHP 项目根目录下建立 .htaccess 文件,然后在.htaccess 文件配置伪静态规则。

标签:

伪静态
  • pbootCMS的伪静态规则方法(全)[2023-08-25]

  • 伪静态文件设置404错误跳转,并成功返回404状态码[2023-09-09]