Connecting Tech Pros Worldwide Help | Site Map

apache redirect remove part of url

Newbie
 
Join Date: Feb 2008
Posts: 18
#1: May 2 '08
How do make a redirect of the following example:

www.test.com/xxx/yyy -> www.test.com/yyy

In other words I would to always remove xxx from the url.
I'm sure it's really straight forward, but I'm not very experienced with Apache.
Markus's Avatar
Moderator
 
Join Date: Jun 2007
Location: York, England, with wolves.
Posts: 4,936
#2: Jun 4 '09

re: apache redirect remove part of url


Quote:

Originally Posted by madshov View Post

How do make a redirect of the following example:

www.test.com/xxx/yyy -> www.test.com/yyy

In other words I would to always remove xxx from the url.
I'm sure it's really straight forward, but I'm not very experienced with Apache.

Something like this (.htaccess file)

Expand|Select|Wrap|Line Numbers
  1. RewriteEngine On
  2.  
  3. RewriteRule ^xxx/yyy$ /yyy [R=301]
  4.  
Read documentation for more information.
Reply