I\'m trying to remove string from the end of URL:
For example i have a structure like this:
http://sitename.com/category/first-category-name/?post_ty
it's simple, just use:
RewriteCond %{QUERY_STRING} "post_type=" [NC]
RewriteRule (.*) /$1? [R=301,L]
If you are going add this to wordpress website, you need add it before any wordpress rules:
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
but after
RewriteBase /
Just do something like this:
RewriteEngine On
RewriteBase /
# Make sure there is a query string
RewriteCond %{QUERY_STRING} .
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* /? [R=301,L]
Place a ? at the end to remove the query when present.