I moved my WP blog 3.8.1 from WP.com to my own domain.

This one is a major pain as it impacts hundreds of pages (?tag, ?category, ?s, ?p, ?feed, ?author) on my small blog. I’d like to redirect:
?tag= to /tag//

I kept the same permalink format as I had on WP.com and /tag/ works if I visit it directly. However Google still visits /?tag= (my sitemaps only contain /tag/…, no /?tag.., so there’s no problem there) and that leads to the 404 error:

You don’t have permission to access / on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

It seems ? and what follows gets stripped by .htaccess which may be a consequence of various security rules which security tools add (I tried to disable those plugins, but that doesn’t help since .htaccess remains the same; I can’t remove them “for a while” because of security reasons, but I can add my own rules at the top of the file if need be). The core rewrite rules from .htaccess are like this:

RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

Is it possible to add some redirection rules at the top of .htaccess to redirect /?tag= to /tag// (note that is user’s query string, not a constant value) and how to do it?

I would use the same approach to redirect that ?category= and other cases mentioned at the top. Another thing worth mention is that there are query strings like /?tag=/page/; if the fix has to strip /page//, so be it).

This not a huge issue, but happens a lot and if it’s not too much trouble - I’d like to redirect this too. If this is considered too many questions in one, please skip it:

/tag//page/x to /tag//page/1 or even to ?s=
This is a problem which I figure is due to different theme/font size/something: for most tags the old site has more result pages, while the new site requires fewer pages to show the same amount of content and so the last 30% of pages (e.g. if tagname on the old site has /tag/tagname/page/15/ pages of content, the new site may have no more than 10 pages) lead to 404 errors.
The question was asked and answered here but IMO not in the best way. I think it’d be better to redirect the user to page 1 for that tagname, or even to the search page (i.e. from /tag//page/X to ?s= (okay, ideally only where X > 1, but even for any X is also OK)).

Read more here: WordPress: ?tag=<param> to /tag/<param>/ and /tag/<param>/page/x to ?s=<param>


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: