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:
- Login to your hosting account and open your
.htaccess
file. - 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]
- 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.
Miloš Spasić
November 17th, 2014 at 6:21 am
Thank you for this tip, you have saved my day.
Kevin
March 3rd, 2017 at 3:02 pm
Great article, I was getting so frustrated and found this, GoDaddy hosting is different, thanks for pointing this out!