wordpress如何路径伪静态处理
来源:互联网 发布:淘宝网大童 编辑:程序博客网 时间:2024/05/18 12:36
本文转自IT摆渡网欢迎转载,请标明出处。
更多文章请阅读
wordpress程序修改
一直以来很多同学学了路径优化,总是纠结网站如何做伪静态处理,今天我来分享wordpress如何路径伪静态处理;(本地网站为例)
没处理之前 基本路径像这种:http://www.域名.com/?p=905
或者这种:http://127.0.0.1/wordpress/?p=4
处理方法:
第一种:设置-固定链接-自定义结构(后面加上:/%post_id%.html)
这样就成功了 是不是很简单呢!
注意:当然,每种空间环境不一样,那么不一定100%解决,所以需要配备环境规则,其他的类似;
下面是支持wordpress的伪静态规则
IIS伪静态规则
IIS 环境是 Windows 主机常用的服务器环境,新建一个 txt 文件,将下面的代码添加到文件中:
[ISAPI_Rewrite]# Defend your computer from some worm attacks#RewriteRule .*(?:global.asa|default\.ida|root\.exe|\.\.).* . [F,I,O]# 3600 = 1 hourCacheClockRate 3600RepeatLimit 32# Protect httpd.ini and httpd.parse.errors files# from accessing through HTTP# Rules to ensure that normal content gets throughRewriteRule /tag/(.*) /index\.php\?tag=$1RewriteRule /software-files/(.*) /software-files/$1 [L]RewriteRule /images/(.*) /images/$1 [L]RewriteRule /sitemap.xml /sitemap.xml [L]RewriteRule /favicon.ico /favicon.ico [L]# For file-based wordpress content (i.e. theme), admin, etc.RewriteRule /wp-(.*) /wp-$1 [L]# For normal wordpress content, via index.phpRewriteRule ^/$ /index.php [L]RewriteRule /(.*) /index.php/$1 [L]
保存,删除记事本的名字,包括后缀名.txt一起删掉,修改为(.htaccess)上传根目录就可以了。
Apache伪静态规则
Apache是 Linux 主机下常见的环境,现在一般的 Linux 虚拟主机都采用这种环境。新建一个 htaccess.txt 文件,添加下面的代码:<IfModule mod_rewrite.c>RewriteEngine OnRewriteBase /RewriteRule ^index\.php$ - [L]RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule . /index.php [L]</IfModule>
然后上传到 WordPress 站点的根目录,重命名为 .htaccess 即可
Nginx伪静态规则
Nginx环境一般是Linux 主机 VPS或服务器用户用的比较多,这些用户一般都会自己配置Nginx,或者有专门的人帮你配置,打开 nginx.conf 或者某个站点的配置环境,比如 wpdaxue.com.conf(不同人配置的不一样),在 server { } 大括号里面添加下面的代码:
location / {if (-f $request_filename/index.html){ rewrite (.*) $1/index.html break; }if (-f $request_filename/index.php){ rewrite (.*) $1/index.php; }if (!-f $request_filename){ rewrite (.*) /index.php; }}
保存,重启 Nginx 即可。
阅读全文
0 0
- wordpress如何路径伪静态处理
- wordpress如何实现伪静态
- nginx下wordpress路径、伪静态配置
- wordpress在IIS7.5下伪静态处理
- 如何设定wordpress为伪静态(URL Rewrite)?
- Apache如何开启Mod_rewrite模块以及Wordpress伪静态
- Apache如何开启Mod_rewrite模块以及Wordpress伪静态
- WordPress简单设置伪静态
- ISAPI_Rewrite设置,wordpress伪静态
- wordpress搜索伪静态【补充】
- yii 伪静态处理
- wordpress伪静态如何支持中文(目前不支持分类目录中文)
- 如何在百度BAE上实现WordPress的伪静态和固定链接
- wordpress如何使用wp_rewrite实现自定义伪静态,非301重定向。
- wordpress伪静态配置全攻略
- Nginx下WordPress实现伪静态
- wordpress安装配置点滴&伪静态化
- Nginx下wordpress伪静态规则(rewrite)
- MySQL入门很简单-MySQL存储引擎
- 初识nodejs26
- kafka-manager 安装
- JAVA解析xml(JDOM,DOM4J)
- 函数式编程之高级函数
- wordpress如何路径伪静态处理
- Rsync详解
- [NOIP2017模拟]Fancy Signal Translate
- 微信小程序:json、map、字符串转换
- Cocos2d-Lua 精灵
- MySQL InnoDB锁机制之Gap Lock、Next-Key Lock
- 第三章:3.4 典型周期信号的傅里叶级数分解
- java RestTemplate调用远程服务接口
- timePicker bootstrap中的12时制与24时制