0

I have a wordperss blog. This blog has two domain names (example1.com and example2.com). In my situation, example1.com redirected to the example2.com. This redirecting work properly.

I saw that Google bot continually indexing my Feedbuner and Wordpress RSS feeds utm_source URL parameters. Then I have added following code to the .htaccess file, above the mod_rewrite rules.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{QUERY_STRING} .
RewriteCond %{QUERY_STRING} !^(s|p)=.*
RewriteCond %{REQUEST_URI} !.*wp-admin.*
RewriteRule ^(.*)$ /$1? [R=301,L]
</IfModule>

Now new domain (example2.com) URL parameters are automatically redirecting to the original posts. But the old domain (example1.com) URL parameters contain URL gives 404 error.

For an instance now old domain URL parameters links give following type 404 error URL (final URL).

http://www.example2.com/example1.com/2013/05/myblogposts.html

How do I fix this issue?

1

Fixed it by adding following code. (just update for others to use it)

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{QUERY_STRING} .
RewriteCond %{QUERY_STRING} !^(s|p)=.*
RewriteCond %{REQUEST_URI} !.*wp-admin.*
RewriteRule .* http://www.mydoman.com%{REQUEST_URI}? [R=301,L]
</IfModule>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.