Frank Vèssia Posted October 24, 2012 Share Posted October 24, 2012 Is there a way to change the default folder for storing images with the image field? With some hooks maybe? I need this because my images can be shared by users and the default path it's "ugly" good for production images but not for sharing images. Link to comment Share on other sites More sharing options...
ryan Posted October 26, 2012 Share Posted October 26, 2012 There isn't an easy way to do that, but you can easily setup your alias from your .htaccess file. For instance, say that you wanted this URL: /site/assets/files/123/somefile.jpg to be accessible at this URL: /123/somefile.jpg You could do that with this rewrite rule, placed in your .htaccess file right after the "RewriteEngine On" line: RewriteRule ^([0-9]+/.*)$ /site/assets/files/$1 [L,QSA] Link to comment Share on other sites More sharing options...
Frank Vèssia Posted October 27, 2012 Author Share Posted October 27, 2012 mmm...that's good, even It's not what I expected to do. I'm really bad in htaccess...there a way to make this thing more complex? I mean, right now the result it's http://www.domain.com/pageid/imagefile.jpg I would like something like http://cdn.domain.com/pageid/imagefile.jpg In this way if I want to activate a real CDN in a future, I can do that without change any code, just removing the htaccess directive. Link to comment Share on other sites More sharing options...
ryan Posted October 28, 2012 Share Posted October 28, 2012 You would just need to setup the cdn hostname so that it points to the same thing as www (and that your server recognizes it). This is not something you'd setup in htaccess, beyond what's already mentioned. But I would suggest not doing that, as it's not ideal from an SEO perspective to have two hostnames pointing to the same thing. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now