Search code examples
apache.htaccesshttp-redirectmod-alias

htaccess redirecting website.com/folder/content to subdomain.website.com/content


I recently moved a Wordpress blog from website.com/wordpress to help.website.com. Now I want to redirect the links to the old adress to the new adress.

I deleted everything from the /wordpress folder except the .htaccess. This file has the following code:

RedirectMatch 301 (.*) http://www.help.website.com$1

It redirects my old links but I don't know how to remove the /wordpress from them.

For example if I access website.com/wordpress/article-categories/example-article/ it sends me to help.website.com/wordpress/article-categories/example-article/, but I want to get to help.website.com/article-categories/example-article/ instead. How do I achieve this?


Solution

  • Try

    RedirectMatch 301 ^/wordpress/(.*)$ http://www.help.website.com/$1
    

    This will match the folder literally without capturing it.