|
-
February 25th, 2011, 07:02 AM
#1
.htaccess, redirect to HTTP_HOST specific folder.
I'm trying to have the server lookup files/images in a different folder, than typed in the address bar.
For example, if somebody types
http://my-domain.com/images/test.jpg
the server should look for the image in:
/images/my-domain.com/test.jpg and not /images/test.jpg as it normally would.
I've managed to get the domain-name into the RewriteRule, but it still isn't working:
RewriteRule ^images/(.*) images/%{HTTP_HOST}/$1 [L]
This WORKS:
RewriteRule ^images/(.*) images/%{HTTP_HOST}/test.jpg [L]
But here the image, test.jpg, is hard-coded which it of course shouldn't be.
Can anybody help? And does it make any sense?
-
February 25th, 2011, 02:44 PM
#2
Re: .htaccess, redirect to HTTP_HOST specific folder.
Oh so close. Try the following instead...
Code:
RewriteRule ^images/(.*)$ images/%{HTTP_HOST}/$1 [L]
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
-
February 25th, 2011, 04:13 PM
#3
Re: .htaccess, redirect to HTTP_HOST specific folder.
Well, it does something else now.
But in my error log I now get (I didn't get that before):
Request exceeded the limit of 10 internal redirects due to probable configuration error
-
February 27th, 2011, 03:04 PM
#4
Re: .htaccess, redirect to HTTP_HOST specific folder.
Try it without the parenthetical regular expression.
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
-
February 28th, 2011, 03:41 AM
#5
Re: .htaccess, redirect to HTTP_HOST specific folder.
This made the trick:
RewriteCond %{REQUEST_URI} !^/uploads/.*?/.*$
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
|
Click Here to Expand Forum to Full Width
|