我创建字preSS的网页,并把php文件就可以了。现在,我可以用它这样的。
I create a page on wordpress and put php file on it. Now i can use it like that.
saita.com/wp_page_name/?name=blqbl&name2=name2 is to long
我的问题是如何重写的.htaccess,因为我希望我的链接,像
My question is how to rewrite .htaccess because I want my link to be like
saita.com/wp_page_name/name1/name 2 is to long
我忘了...我的PHP文件是主要根源。
I forgot... my php file is in main root..
我试图把我的.htaccess
I tried to put in my .htaccess
RewriteRule ^(.+)/([a-zA-Z0-9-_]+)?$ upcoming.php?league=$1&division=$2
但它不能正常工作。
but it doesn’t work..
编辑:如果我得到它的权利,我要改变我的.htaccess或者我应该把一些新的code中的functions.php
If i get it right, i should change my .htaccess or should i put some new code in functions.php ?
EDIT2:我说这code
add_action('init', 'custom_rewrite_rule', 10, 0);
function custom_rewrite_rule() {
add_rewrite_rule('^machove/([^/]*)/([^/]*)/?','index.php??pagename=machove&league=$matches[1]&division=$matches[2]','top');
}
add_filter('query_vars', 'foo_my_query_vars');
function foo_my_query_vars($vars){
$vars[] = 'league';
$vars[] = 'division';
return $vars;
}
在我的functions.php月底,然后我重新保存我的永久链接,现在当我打开saita.com/machove/name1/name2,我的网页上的信息是从saita.com/machove/但是URL是saita.com / machove /名称1 /名2
at the end of my functions.php, then i resave my permalinks and now when i open saita.com/machove/name1/name2 , my page info is from saita.com/machove/ but the url is saita.com/machove/name1/name2
使用以下内容:
RewriteRule wp_page_name/(.*)/(.*) /wp_page_name/name1=$1&name2=$2