官方文档说douphp安装成功后为自动生成伪静态规则文件htaccess.txt,但是某些主机空间会出现提示“暂无与您的服务器匹配的伪静态规则”的情况。本人就不幸遇到了,官方答复下载规则包,却没给出下载地址,我也没找到官方给出的伪静态规则内容。

百度了半天也没找到答案,后来看到官方集成安装包,想到本地安装一下,会有伪静态文件生成,果然如此。
下面是内容,我把以上规则复制到主机空间的.htaccess文件里,完美解决。

<FilesMatch "\.(bak|inc|lib|sh|tpl|lbi|dwt)$">
    # Apache 2.4ртоб
    Order Deny,Allow 
    Deny from all
 
    # Apache 2.4ртио
    # Require all denied
</FilesMatch>

RewriteEngine On

#RewriteBase /
RewriteRule ^index\.html$    index\.php [L]
RewriteRule ^sitemap\.xml$    sitemap\.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)

# common
RewriteRule ^([^?]*) index.php?route=$1 [L,QSA]

# php -- BEGIN cPanel-generated handler, do not edit
# Set the Б─°ea-php72Б─² package as the default Б─°PHPБ─² programming language.
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php72 .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit

标签: douphp, 伪静态

评论已关闭