Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I don't know a whole lot about .htaccess rules so forgive and help me ask the correct question.

Currently I have a .htaccess rule like:

RewriteRule ^surveys/(\S+)/directory/(\d+)/(\d+)/entry/(\d+)/?$ directories/index.cfm?sFuseAction=XXX.YYYY.ZZZZ&nDirectoryID=$2&nEntryID=$4&nCategoryID=$3&sDirectory=$1 [NC,L]

which I want to do a 301 redirect to:

RewriteRule ^(\S+)/directory/(\d+)/(\d+)/entry/(\d+)/?$     directories/index.cfm?sFuseAction=XXX.YYYY.ZZZZ&nDirectoryID=$2&nEntryID=$4&nCategoryID=$3&sDirectory=$1 [NC,L]

I'm unsure of the correct syntax to go about making these redirect correctly.

share|improve this question

If you want to do a 301 redirect you will have to use the full URI path including the FQDN and protocol. Like so:

RewriteRule ^(\S+)/directory/(\d+)/(\d+)/entry/(\d+)/?$     http://www.example.com/directories/index.cfm?sFuseAction=XXX.YYYY.ZZZZ&nDirectoryID=$2&nEntryID=$4&nCategoryID=$3&sDirectory=$1 [NC,L]
share|improve this answer
I notice you don't include anything to indicate this is a 301, i've seen other examples of using [R=301,NC,L] at the end... is there a reason for this? – Jarede May 23 '13 at 8:57

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.