Skip to main content

Access image and other files from Server on drupal local setup using .htaccess

You have local installation of drupal 7. Suppose its 'http://tms.devs' and its live suppose 'www.example.com'. Now you have the database of live site and also the latest files except the image files. Now you don't want to download all the images from server. to keep your local development environment light. So you can access the files from the live server using .htaccess file. 

To access the files Form server  write the following codes to your root .htaccess file: 
RewriteCond %{REQUEST_URI} ^/sites/default/files/(.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ http://example.com/$1 [L,QSA]

Comments

Popular posts from this blog

Git Repair Permissions

Git Push Error: insufficient permission for adding an object to repository database When you try to push to a shared git remote, you get the following error:  insufficient permission for adding an object to repository database After you have identified and fixed the underlying cause (see below), you’ll want to repair the permissions: cd /path/to/repo.git chgrp -R groupname . chmod -R g+rwX . find . -type d -exec chmod g+s '{}' + Underlying Causes The error could be caused by one of the following: The repository isn’t configured to be a shared repository (see  core.sharedRepository  in  git help config ). If the output of: git config core.sharedRepository is not  group  or  true  or  1  or some mask, try running: git config core.sharedRepository group and then re-run the recursive  chmod  and  chgrp  (see “Repair Permissions” above). The operating system doesn’t interpret a setgid bit on directories as “all new files and subdirectories should inh

Why ReactJS ?

I was decided to learn ReactJs. And asking my self why I want to learn React. What can I do or build using React? To get the answer I do some Researchs and make couple of important notes. Hope It will help who have interest to learn ReactJS. Lets know what is React First.  React is a JavaScript library for building User Interface s. Very often it’s misinterpreted as tool, framework, language. React allows developers to create large web applications that use data which can change over time, without reloading the page. Its main goal is to be fast, simple and scalable. React processes only user interface in applications ( source ).   It also can be use along with other JS freamwork.  To learn More visit :  https://reactjs.org/ As Inspired from Simon Sinek The author of "Start with Why", firstly I was finding my why's. Love the Quote : It is one of life’s greatest joys to wake up in the morning... every morning, With a clear sense of why that day matters, why

Download Files From Remote to local via command line

To download Files From Remote to local via command line  normally we use scp. To copy all from  Local Location  to  Remote Location  (Upload) scp - r / path / from / destination username@hostname :/ path / to / destination Copy on current directory from  Remote to Local scp - r username@hostname :/ path / from / file . To download a single file the command will be: scp user@your . server . example . com :/ path / to / foo/file.name / home / user / Desktop / To download a single file the command will be:  scp - r user@your . server . example . com :/ path / to / foo / home / user / Desktop / Help: -r  Recursively copy all directories and files Always use full location from  / , Get full location by  pwd scp  will replace all existing files hostname  will be hostname or IP address if custom port is needed (besides port 22) use  -P portnumber . (dot)  - it means current working directory, So download/copy from server and paste here only