简体   繁体   中英

wordpress htaccess rewriterule

my wordpress .htaccess file look like

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

i want add my owm rewriterule but is not working rule have to rewrite page/([az,AZ]+).html$ to pages?page_name=$1

Here is the rule to do what you ask for:

RewriteRule ^page/([a-z,A-Z]+).html$ pages?page_name=$1 [NC]

Placing this after RewriteRule. /index.php [L] RewriteRule. /index.php [L] should do it.

it began to work only after:

  1. adding [NC,L] in the end of my RewriteRule

  2. using absolute path http://site.ru/pages?page_name=$1

also i recomend you to read this post it shows how to add your custom rewriterule to WP

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM