Software Developer

301 Redirect a WordPress URL in GoDaddy the Right Way

Here is the solution when you need to do a 301 redirect for a URL (or many URLs) for a WordPress site the right way. This will show you how to manually add Rewrite rules directly to your .htaccess file. This method works.

Doing a 301 Redirect for a URL on your WordPress site when you have GoDaddy shared hosting (or “Web Hosing”) can be tricky. You may notice that your .htaccess file gets overwritten, or your Rewrite rules and Redirect rules get ignored by GoDaddy. GoDaddy support may have directed you to use their new interface for adding “URL Redirects“. But that interface lets you redirect only one at a time, and it gets very confusing if you’re hosting multiple sites on your hosting account.

Here is the right way to add 301 redirects:

  1. Login to your hosting account and open your .htaccess file.
  2. On a new blank line at the very top of the file, enter this Rewrite Rule:

    rewriterule ^old-slug.html http://yourdomain.com/new-slug/ [R=301,L]
    
  3. You must make 2 changes to the Rewrite Rule above. The tiniest details matter here.

    – Change the letters “old-slug” to your own article slug (the old slug of the article that you are trying to change.) Note that the slug is not the entire URL.

    – Notice that I do not use “$” after the old-slug.

    – Change “yourdomain.com/new-slug/” to the new URL of the article that you are trying to change.

By

We've 2 Responses

Leave a Reply to Miloš Spasić Cancel reply

Your email address will not be published. All comments will be moderated.

Please wrap code in "code" bracket tags like this:

[code]

YOUR CODE HERE 

[/code]