WordPress Apache和Nginx伪静态设置方法和规则文件

追格官方小助手/ 2022年07月21日/ WordPress/ 浏览 1247

早期追格小编也发过一篇《WordPress主题怎么设置伪静态和自定义固定链接》


今天说说Apache和Nginx伪静态设置方法和规则文件


1、Apache,需要在网站根目录 .htaccess 文件中添加以下代码


<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>


2、Nginx,若系统没有自带配置,那么我们需要手动配置


location / {
  try_files $uri $uri/ /index.php?$args;
}

# Add trailing slash to */wp-admin requests.
rewrite /wp-admin$ $scheme://$host$uri/ permanent;


发表评论

暂无评论,抢个沙发...

客服 工单