2
我想使用add_rewrite_rule在wordpress中重寫我的帖子網址。只有在設置了query_var動作的情況下。 例如:example.com/my-post-name-slug/?action=query_action
收件人:example.com/my-post-name-slug/query_action
URL Rewrite wordpress
可能嗎?
htaccess的
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /hot/
RewriteRule ^ajax/([^/]*)/([^/]*).html$ /hot/wp-admin/admin-ajax.php?action=$1&movie_id=$2 [L]
RewriteCond %{REQUEST_FILENAME} ^\?action\=$
RewriteCond ^\?action\= ^/?$
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /hot/index.php [L]
</IfModule>
# END WordPress
UPDATE:解決
add_rewrite_rule('^slug/([^/]*)/([^/]*)/?','index.php?post_type=tpp&name=$matches[1]&action-query=$matches[2]','top');
它不工作 –
嗯,,它吐出一個錯誤? – Mukund
虐待重做它,我只是測試它,它dosent工作 – Mukund