Is it possible to run two appcache file in a site. For example in home.html there is home.appcache while in about.html there is about.appcache , each of the file will cache different resources. I want to know if it's possible to cache by pieces.
I've already tried it and it is working,it means that there is no need to download all the resources using only one appcache file, we can use one or more appcache file in a site but we need to put it in different html pages. using this technique only the updated resources will be cached and be downloaded,there is no need to download all resources.
Related
I have a website running on an apache2 server and serving out of a user directory. The URL looks like this: http://example.com/~user1
This serves up files on my server located at /home/user1. The problem that I am facing is that a lot of the asset URLs throughout the site are put into the HTML as relative paths like this: <img src="/images/example.png" alt="" />
This is attempting to load the image from http://example.com/images/example.png, but I actually want it to serve from http://example.com/~user1/images/example.png.
How can I accomplish this?
/images/example.png
This is a root-relative, not a relative URL-path.
This is attempting to load the image from http://example.com/images/example.png, but I actually want it to serve from http://example.com/~user1/images/example.png.
This is a client-side/browser URL resolution issue. There are no "switches" on the server that can be applied to change this behaviour, without changing the actual URLs.
This is an inherent problem with using Apache per-user web directories.
Your options are:
Don't use Apache per-user web directories. ie. Remove /~<user1>/ from the URL.
Or,
Use relative URL-paths to your assets. eg. images/example.png (no slash prefix). So the browser correctly resolves this as /~user1/images/example.png instead (when accessed from the document root at least). But this creates additional problems if you are rewriting the URL of your pages at different path depths or using common templates in your pages etc.
I have a Laravel 5 project in which I am uploading files in database in Medium Blob format.
But uploading files in database takes some extra time to execute.
Uploading files in database is a secured way to keep files safe from crawlers or some bots.
I have tried to Upload files to the Public folder. But the crawlers can open these files.
Is there any possible way to upload files in the file system?
So that the Crawlers cannot open these files.
I want these files to be Secured
you can upload them outside of the public scope. For example, storage/ folder is a good place. Also, you can grab them using the file system manager. Take a look:
$image = \Storage::get('file.jpg');
Edit
A correct laravel installation just allow the content of public/ to be accesible via web browser. If other directories as storage/ or resources/ are public too, then you installation is really incorrect.
Said that, once you upload the files in storage/ folder nobody can access them except by you using the \Storage facade. When you call for example \Storage::get('file.jpg'); it returns an stream of bits that you can allocate them in a temporary folder and then display it in the webside. Once the request has finished, the image will disappear again from public domain.
No need to change the directory this can be achieved by two ways
LazyOne Answer using .htaccess
AND
Using robots.txt
I will suggest to implement both .htaccess and robots.txt as some cheap crawlers ignore robots.txt but they can't ignore .htaccess
You can follow this method
image-accessibility-for-authenticated-users-only
As this only allows authorized uses to view image
I'm building a website using Middleman. There are source files placed like the following.
source/index.html.md
source/errors/404.html
source/docs/foo.html.md
source/docs/bar.html.md
By default, when I build static html files, the generated files are placed following to the original directory structure (with directory indexes).
build/index.html
build/errors/404/index.html
build/docs/foo/index.html
build/docs/bar/index.html
However, I want all html files to be served directly under /, so that they can be accessed like http://example.com/foo/ and http://example.com/404/.
How do you change the paths for generated html files?
You can use proxies to create duplicate pages, and then ignore the original pages.
https://middlemanapp.com/basics/dynamic-pages/
But the simplest way is, of course, to adjust the source structure to match the desired structure.
I think this part of Middleman doc could help you .
All you need is to activate directory indexes and configure it properly, and it should work.
I am using Pyrocms for an application. There is a module available for File managment. Although it is good enough but i need to customize it according to my requirements.
Here are the requirements
For each file admin from backend can create multiple temporary links
Each file should be limited to some time duration defined by admin
And download limit should be 3 for each user
Now i need suggestions how i can do these tasks to accomplish the application.
Do i need some more tables to handle the situation?
Or can i extend existing file table.
What about temporary links how can i create them and let user download the file?
Another requirement if user uses the link, download popup comes and he cancels three times i have to restrict him now that he can not download it now.
So using ip will do it or some other suggestion.
If i have to send multiple links to a single user through email then how can i customize the File modules to fit my needs.
Please give some suggestion.
Would the Download module help at all?
This all sounds like it should be an extra module, as the Files job is just to handle Files. Downloads are a very different aspect, but you can use the Files library in PHP to get lists of files and server them up?
So:
Files handles Files.
Downloads handle the downloading of "Files"
If the Download module by Authur Guy is not good enough for your needs you should definitely think about building one and selling it on the store.
I want to prevent users access for my "~/Content/..." folder I wrote it as follow in "Global.asax.cs" and put this line of code at the top of every other routes
routes.IgnoreRoute("Content/{*pathInfo}");
but it does not work. in fact user can see every files in content folder by type the URL in browser.
am I missing something?
How did you figure out that it does not work? Give example.
You may have put it last in the Routing table. So try to move it up so that it gets added to the routing table first. The route collection is an ordered list of routes.
Also try this : Routes.IgnoreRoute("Content/");, but your version of ignore is also correct and it should work.
Lastly, I do not know what you mean when you say the user can see all the contents of the Content folder : Isn't that the point? User must be able to download files from the folder, and we usually just need MVC to ignore the requests from coming into the framework, and so that IIS can directly serve those files.
or did you mean Directory browsing is enabled, and you want to disable that : In that case go to IIS manager, and select your website and look for the Directory browsing option and disable it as shown here.
Your problem cannot be solved by routing constraints. There are 3 significant steps in processing request:
IIS got request.
IIS watch at filesystem and search for direct correspondence to file
If IIS didn't found any file - it gives request to ASP.NET MVC for processing.
So, you need to configure folder security to forbidden direct access to files, but allow access to application, as here.
But I don't recommend to secure folder, that should be shared. I don't believe that your site shouldn't have images to display :) If you have some secured content, you need to create another folder.