添加自定义的重写规则,使字preSS不会这将覆盖 [英] Add custom rewrite rule so wordpress won't overide it

查看:135
本文介绍了添加自定义的重写规则,使字preSS不会这将覆盖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的htaccess文件,文字preSS多点htacces。我需要把我的自定义规则,在那里,而不是让字preSS aoverride它。我怎样才能做到这一点?大胆的一个是我的自定义重写规则。

  RewriteEngine叙述在
的RewriteBase /**我的自定义规则的RewriteRule ^ / \\?当前页=(\\ D +)$当前页/ $ 1.HTML [NC,L] **重写规则^指数\\ $的.php - [L]#上传的文件
重写规则^([_ 0-9A-ZA-Z - ] + /)?文件/(.+)WP-包括/ MS-files.php文件= $ 16 [L]#增加一个尾部斜杠/可湿性粉剂管理员
重写规则^([_ 0-9A-ZA-Z - ] + /)?WP-ADMIN $ $ 1WP管理员/ [R = 301,L]的RewriteCond%{} REQUEST_FILENAME -f [OR]
的RewriteCond%{} REQUEST_FILENAME -d
重写规则^ - [L]
重写规则^([_ 0-9A-ZA-Z - ] + /)?(WP-(内容|管理|包括)。*)$ 2 [L]
重写规则^([_ 0-9A-ZA-Z - ] + /)?(。* \\ PHP)$ $ 2 [L]
重写规则。的index.php [L]


解决方案

通过重写规则您只能检查URI路径,而不是查询。您需要使用的RewriteCond QUERY_STRING 的为URI查询:

 的RewriteCond%{QUERY_STRING} ^当前页=(\\ D +)$
重写规则^ $当前页/%1.HTML [NC,L]

This is my htaccess file, wordpress multisite htacces. I need to put my custom rule in there and not let wordpress aoverride it. How can i do that? The bold one is my custom rewrite rule.

RewriteEngine On
RewriteBase /

**MY CUSTOM RULE RewriteRule ^/\?currentpage=(\d+)$ currentpage/$1.html [NC,L]**

RewriteRule ^index\.php$ - [L]

# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule  ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule  ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]

解决方案

With RewriteRule you can only check the URI path and not the query. You need to use RewriteCond and QUERY_STRING for the URI query:

RewriteCond %{QUERY_STRING} ^currentpage=(\d+)$
RewriteRule ^$ currentpage/%1.html [NC,L]

这篇关于添加自定义的重写规则,使字preSS不会这将覆盖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆