.htaccess - Wordpress URL - Need to remove a GET parameter -


i know there lot of threads .htaccess url rewriting, case seems bit different , have tried lot doesn't work.

my current url: http://example.com/forest/trees/?type=perennial

what need is: http://example.com/forest/trees/perennial

i need remove ?type= url.

edit: url may contain hyphens - between strings @ point (except domain name ofcourse). can dense-forest or non-perennial too.

it's custom code , plugin, can't modify it. need url beautified.

any appreciated.


what i've tried far in .htaccess:

rewritecond %{the_request} ^(get|post|head)\ /forest\/trees\/\?type=([^&]+) rewriterule ^ \/forest\/trees\/%2\/? [l,r=301] 

and

rewriterule ^\/forest\/trees\/([^/]*)?  /forest/trees/?type=$1 [l] 

my current wordpress .htaccess is:

# 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 

thanks in advance. :) cheers!

you can use .htaccess file:

# begin wordpress rewriteengine on rewritebase /  rewriterule ^forest/trees/([^/]+)$ /forest/trees/?type=$1  rewriterule ^index\.php$ - [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /index.php [l] # end wordpress 

now urls http://example.com/forest/trees/perennial internally redirect /forest/trees/?type=perennial , wordpress dispatcher /index.php.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -