.htaccess - I want to change URL for specific page for my wordpress site through htaccess or using wordpress function -
i have url http://www.shreyinnovations.com/edudemo/app-detail/?app-detail=a-level%20revision need replace below http://www.shreyinnovations.com/edudemo/app/a-level%20revision
i change .htaccess file change below
# begin wordpress <ifmodule mod_rewrite.c> rewriteengine on rewritebase /edudemo/ rewriterule ^app/([0-9]+)$ app-detail?app-detail=$1 [qsa] rewriterule ^index\.php$ - [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /edudemo/index.php [l] </ifmodule> # end wordpress
i used wordpress function change appche rule rewrite address this
add_action( 'init', 'app_detail_rewrite_rules' ); add_action( 'generate_rewrite_rules', 'app_detail_rewrite_rules' ); function app_detail_rewrite_rules(){ add_rewrite_rule('^app/([0-9]+)','app-detail?app-detail=$matches[1]','top'); }
but still can't url want.please let me know if have solution this.
thanks in advance.
try adding code before wp rule-set:
rewriteengine on rewritecond %{request_uri} ^/edudemo/app-detail [nc] rewritecond %{query_string} app-detail=([^&/]+) [nc] rewriterule .* /edudemo/app/%1? [r=301,l] # begin wordpress
for internal mapping, remove r=301 [r=301,l]
Comments
Post a Comment