Forum Moderators: phranque
I would like to write a rewrite to
1) shorten the path to the files
2) stop users being able to see the actual path to the upload directory
I've tried with this
RewriteRule ^CMSimg/*$ /cms/tinymce/uploaded/$1 [NC]
and tested embedding an image:
<img src="/CMSimg/picture.jpg">
But this doesn't seem to work
I wasn't sure if this would work when specifying a src so I ammended the Rule to test
RewriteRule ^CMSimg/$ /cms/tinymce/uploaded/picture.jpg [NC]
<img src="/CMSimg/">
And this worked
Any suggestions on my error in the first example?
Unfortunately, you have no parentheses in your pattern, so therefore, $1 is undefined.
Also, you must use regular-expressions to construct patterns. Your "^CMSimg/*$" pattern will match a requested URL-path starting with "CMSimg" followed by zero or more consecutive slashes -- The "*" is a regular-expressions quantifier, not a wild-card as it is in DOS, for example. I'd suggest:
RewriteRule ^CMSimg/(.+)$ /cms/tinymce/uploaded/$1 [L]
Jim
[edited by: jdMorgan at 12:56 pm (utc) on Oct. 5, 2007]