views:

28

answers:

1

I have the following rewrite rule which is working fine:

RewriteRule ^([a-zA-Z\-]+)[/]?$ apply/?survey_folder=$1

which turns this: address.com/folder1/
into this: address.com/apply/?survey_folder=folder1

The problem is that I can't figure out a way to use a redirect to the rewritten URL. Using cfml as an example, (cflocation url="http://www.address.com/folder1/") throws an error because, of course, the folder "folder1" doesn't actually exist on the server.

I can get the user redirected to the correct page by using /apply/?survey_folder=folder1, but that defeats the purpose of having the rewrite rule at all.

Is there any way to redirect to a URL rewritten by htaccess? I'm new at RewriteRule.

A: 

Have you tried setting RewriteBase? Its purpose is to map the URL to the physical location on the server. I'm not completely sure this is the problem you are having, but it does sound like a possibility.

http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewritebase

Andrew
Thanks for the tip. I read your link and decided it wasn't quite what I was looking for because I would need to have a base path for each different folder (of which, there could be thousands). I went back and tried things again and it appears to work perfectly fine to do a redirect to a rewritten URL. I must have just had a typo somewhere. I appreciate your help though!
thequeue