I know there are many streams for rewriting a URL .htaccess
, but my case seems to be a little different, and I tried a lot, but it does not work.
My current url is: http://example.com/forest/trees/?type=perennial
What I need: http://example.com/forest/trees/perennial
I just need to remove ?type=
from the url.
EDIT: The URL can contain hyphens -
between lines at any point (except for the domain name). It can be dense-forest
or non-perennial
also.
This is custom code and a plugin, so it cannot change it. I just need a decorated URL.
Any help would be greatly appreciated.
What I have tried so 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:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
Thanks in advance. :) Hooray!