-
killer htaccess question... how to target parent directory?
hi guys, i have a htaccess line that looks somethihng like this:
RewriteRule ^alpha.jpg$ ../alpha.jpg [L]
basically as you can see it is trying to target an equivalent file in the parent directory, but it only returns a bad request because i guess the double-dot-and-slash ( ../ ) is not recognised in htaccess like it would be in a php script?
it's so hard finding anyone who knows htaccess like the back of their hand, and so hard finding somewhere to ask for help with advanced htaccess... does anyone have a solution to this problem?
-
-
You can set the rewrite base to the higher directory. Then treat the first item as dir/alpha.jpg and the second as just alpha.jpg-- you can also use $1 (I believe) and that will use the matched item (alpha.jpg) as the value in the second part.
I haven't tested this, but since you said it's hard to find help (and it is), this is how I'd start. I'm not an expert either but if you play with the settings for long enough you can usually find a way for it to work.
Daniel -
Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum
-
The Following User Says Thank You to djr33 For This Useful Post:
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks