clean url's Drupal Gallery2 - drupal

I'm trying to configure my Gallery2 integration in Drupal but i'm stuck at Step 4.
I have to put in two path's to drupal's .htaccess file.
The public path (This is the location of your Drupal .htaccess file relative to your webserver document root.)
Filesystem path (This is the absolute directory path of your Drupal .htaccess file.)
but i have no idea what i have to put where?
My site sits in public_html/5.0, is this the public path?

From manual:
"You may also decide to skip this step in case you dont want/need short URLs for your embedded gallery."
Usually .htaccess for drupal is located where you unpack "drupal....tar.gz".
Try an empty field or ".".
For absolute directory path enter the document root (public_html or public_html/5.0) and execute "pwd" command. You'll receive something like /home/user1/public_html/5.0
This is your absolute path.

Related

DRUPAL 7 - Clean URL and relative path : it's doesn't work

I start with Drupal and I have read some of topics about my problem but I didn't found the solution.
My problem is the following :
On my website (for the moment in localhost) I use Clean URLS module. The problem is when I enable this module and when I use the relative path of my files, my pictures or links don't work.
For example : src="./sites/default/files/styles/large/public/add_tool_version.png".My pictures are not visibles.. I don't know why this module doesn't work with the relative path.
But when I disable the module, the link is works fine.
Please, can an you help me ? Do you have any solution to fix it ?
Thanks in advance for your answers
Try using absolute paths. In you case with image it would be like:
src="/sites/default/files/styles/large/public/add_tool_version.png", without dot.
This absolute path will always refers to that image instead of relative path - it depends on you current directory or page.
The problem with clean urls is the way browsers read urls and interpret them as directions in a file directory. Lets say you are at http://www.example.com/?q=node/11, or, with clean urls enabled, at http://www.example.com/node/11.
When enabeling clean urls, and putting a link with a source into some node, your browser will search for your files in the folder that is specified in your url. Thus, when you declare the source to be sites/default/files/styles/large/public/add_tool_version.png and are on the url http://www.example.com/node/11, then the browser will look for the file in the directory node/11/sites/default/files/styles/large/public/. Usually this would work, but in drupal, there actually is no such folder. All drupal pages are just versions of the index.php in your base-directory. In drupal, the url doesn't have anything to do with file structure - unfortunately, the average browser doesn't know that.
Without clean urls, however, your browser will recognize the url as a combination of a base path (www.example.com) and a query (?q=node/11). It will therefore look for your file starting from the directory specified in your base path.
If you still want to have your relative paths working with clean urls enabled, you can use the function base_path() in front of your actual source.

Index.php in uploads directory - Wordpress

I have a plugin on a Wordpress site called WP Security, most of the stuff it does is easy to use and understandable, the changes it suggests like not have default 'WP_' prefix for databases etc.
One of the things it highlights is: The index.php file was not found in the uploads directory! You should create one in order to prevent directory listings.
So can anyone tell why preventing directory listings is good and do I need to put anything in the index file, and if so what code do I need to put in? Finally what is the importance of the index file in website I don't really get this part of web design? I have read it has to be there to make site visible to browsers but why is this, why can't browsers just use the URL with no index page?
Thanks for suggestions
Andrew
Yes, blocking directory index is a good idea in web apps. The index.* file is interpreted by web server instead of providing standard directory listing. Creating an empty index.* file is ony one (although the easiest and compatible with all(?) http servers) way of blocking users from viewing the contents of the directory. Another way is to configure webserver to not serve the directory index. In Apache this can be done in the .conf file with
Options -Indexes
in the <Directory> clause. Or you might tell apache to:
AllowOverride All
And create a .htaccess in the directory containing:
Options -Indexes
line.
Yes creating index.* file is really necessary to protect your asset as absence of index files shows whole directory structure and listed assets.
Easiest way to create an index.php file with simple coding.

How to protect /sites folder recursively?

I want to protect /sites (recursively up to files folder or up to the last folder) so that anonymous users will not be able to download any files from there.
I've checked the .htaccess file (under /sites) and it should prompt 404 error for anonymous access, but this is no happening, instead it display all files and folder under /sites.
What should be added/changed in the .htaccess file?
For any anonymous access it should prompt users for a 404 error but unluckily this is not taking place.
Please advise what to add in the .htaccess file (or other approach) to protect /sites folder recursively.
I hope I have drawn my issue clearly. Looking forward for a solution.
D7 / Centos 6
First, you need to prevent Apache to list files (directory listing):
http://www.thesitewizard.com/apache/prevent-directory-listing-htaccess.shtml
Secondly, you need to enable Private file storage in Drupal 7:
a) https://drupal.org/documentation/modules/file
b) http://openconcept.ca/blog/mgifford/setting-drupal-7s-private-file-system
Please remember, that Apache doesn't know about Drupal file permissions and it will serve any file unless you tell it not to (with some exceptions).

Relative path from site root

I feel like a nub for asking this, but I can't figure it out.. I've found several posts (here's one) saying that to use a relative path from the root of your site, start the path with /, ex:
<img src="/images/img1.jpg" />
My file hier. looks like
-root
-images
-css
-index.aspx
-subFolder
-test.aspx
Now when I use the src path as shown above, it doesn't work in either index.aspx or test.aspx, but when I remove the /, it works for index.aspx. In test.aspx, I used ../images/img1.jpg and it works. What gives? Why is my example above not working?
Your site is probably in a virtual directory, so the "/" refers to the actual web root as IIS (or whatever web server) sees it - maybe the folder above your 'root' folder
.
The relative paths work because they are traversing the directory based on the location, so for index.aspx it needs to go into images folder and get the img1.jpg, for test.aspx it needs to go up one level .. then into the images folder and get the img1.jpg.
Absolute paths are based off of were the application is installed from based on IIS settings. If you are just testing this from that folder your absolute path needs to include the root folder. /root/images/img1.jpg and then it will work from both test and index with the same absolute path.

where does drupal save images when you use cck and imagecache?

I am thinking in moving all JS and images from webserver to another server to mitigate the load on my webserver. then i will use parallel module to get this stuff from the other server.
now, currently i am using cck and imagecache modules. and i dont know where does drupal save the images.
i checked mysql (files table) and found something like this
Mysql>select filepath from files limit 2;
sites/default/files/2010413132344592734_2.jpg
sites/default/files/2010491910913580_5.jpg
i checked for such files but i didnt find anything like this in this directory!!
i inspected one of the images in one of my articles and found that this image is in one of the cache folders that have been generated automatically by imagecache module. i tried to delete this image from server and refreshed my page, imagecache recreated it.
now where did imagecach get this image from? where does drupal save my images??
Thanks for your help
Imagecache takes source images from whatever path is set in the files table, which is generally sites/default/files, the directory you listed. Your imagecache directory was within that directory, right? I think your files are probably in that directory and you just missed them for some reason. Directory listing cached in your FTP client, maybe?
For myself, it stores everything in the sites/default/files folder.
But, some settings to look at...
The File system path setting, located at ?q=admin/settings/file-system
The path settings for the particular field. Open the settings for the particular field, and look in the File path setting in the Path Settings fieldset.
If those settings are different, your file may be somewhere else. Otherwise, it's going to be in your sites/default/files folder.
Check the following locations
[...]\htdocs\drupal\sites\default\files\field\image
[...]\htdocs\drupal\sites\default\files\styles\large\public\field\image
[...]\htdocs\drupal\sites\default\files\styles\medium\public\field\image
[...]\htdocs\drupal\sites\default\files\styles\thumbnail\public\field\image
where [...] is the location of the htdocs folder inside your webserver container.
If you are using xampp then it could be C:\xampp183\htdocs............
Hope this helps !
In the drupal database, check the table "file_managed" and the column "uri" (which gives the uri to access the file either local or remote).
You might find a value like below .. (ignore the jpg name , that is only for my setup)
public://field/image/8_mayurkotlikar_tigress5.jpg
This shows the location of the image.

Resources