Relative redirect path with mod_rewrite

Possible duplicate:
Mod_Rewrite with relative path redirection

I have a series of RewriteRules in .htaccess for my site that I am in the process of restructuring.

# Requests for http://example.com/contents/section/4/48/
# get redirected to http://example.com/courses
RewriteRule ^content/section/4/48/$ /courses [R=301,L]

      

This works great, except that right now I have a new and unpublished site located in a subdirectory /new/

and so during testing I need the rules to redirect to /new/courses

instead of /courses

... Basically I just want it to redirect the url- htaccess file.

/home/user/www/new/.htaccess --> redirect to /new/courses
/home/user/www/.htaccess --> redirect to /courses

      

It doesn't seem like I have to change every line in the /new/.htaccess file when I translate it to the root directory. Is there something I am missing?

+4


source to share


1 answer


Unverified - but you should just remove the "/" from your target i.e.



RewriteRule ^content/section/4/48/$ courses [R=301,L]

      

-3


source







All Articles