Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

madhu
madhu
10,223 Points

Need help with an URL redirection issue.

Hi!

I want to permanently redirect an old URL to a new URL on a WordPress site I'm working on. I'm using .htaccess file to create the redirects.

OLD URL (that does not exist anymore): http://www.project-equity.org/programs/worker-coop-academy/

NEW URL (destination URL): http://www.project-equity.org/communities/

Redirect I have created in .htaccess file: Redirect 301 /programs/worker-coop-academy/ http://www.project-equity.org/communities/

This redirect is not working because the OLD URL (instead of being redirected to the NEW URL) is being automatically redirected to an URL that I have not specified: http://www.project-equity.orgworker-coop-academy/ This automatic redirect is giving a 'This site cannot be reached' error!

As you can see in the automatically redirected URL the trailing '/' at the end of .org is missing and hence the browser is treating it as domain and hence the 'Site cannot be reached' error.

Do anyone have an idea what is happening here? How do I bypass this automatic redirect and end up at the NEW/DESTINATION URL?

I have searched through several forums but have not been able to find a solution. Any help will be greatly appreciated.

Thank you!

Madhu

1 Answer

Samuel Glister
Samuel Glister
12,471 Points

Hi,

A good plugin for sorting this is is 404 to 301: https://en-gb.wordpress.org/plugins/404-to-301/

Your redirect looks right so not sure what happened there. I'd install this, watch it for a few days and set any 404s to pages necessary :)

Hope this helps