Add custom rewrite rule so wordpress won't overide it
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-]+/)?开发者_JAVA百科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]
精彩评论