Sign up ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I would like to setup a redirect using an .htaccess file which keeps part of the URL's path in the target URL. For example:

I have the domain I want to redirect to BUT if someone types in I want it to redirect to, and would like it to work the same way for any value entered after the /social/ directory.

What might I add to an .htaccess file in order to do this?

share|improve this question
I edited this to be less broad, and specific to doing this with an .htaccess file in order to make it on-topic. –  dan Jul 26 '14 at 0:52
@dan thanks for that :) –  DziNeIT Jul 26 '14 at 10:22

1 Answer 1

up vote 1 down vote accepted

This should do it.

RewriteEngine On
RewriteRule social(.*)$1 [R=301,L]
share|improve this answer
Yeah, it needed the / removing before social but it works great after that :) –  DziNeIT Jul 26 '14 at 10:38

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.