Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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