background preloader

301 Redirect

Facebook Twitter

Helicon Tech - IIS modules and ISAPI filters for URL rewriting and search engine optimization. .htaccess, 301 Redirects & SEO: Guest Post by NotSleepy. Redirecting Subdirectories to the Root Directory via HTAccess. One of the most useful techniques in my HTAccess toolbox involves URL redirection using Apache’s RedirectMatch directive.

Redirecting Subdirectories to the Root Directory via HTAccess

With RedirectMatch, you get the powerful regex pattern matching available in the mod_alias module combined with the simplicity and effectiveness of the Redirect directive. This hybrid functionality makes RedirectMatch the ideal method for highly specific redirection. In this tutorial, we will explore the application of RedirectMatch as it applies to one of the most difficult redirect scenarios: redirecting all requests for a specific subdirectory (or any subordinate directory or file) to the root (or any parent) directory.

We will explore how to accomplish this redirect using PHP in a subsequent article. The Scene.