I am trying to resolve the "leverage browser caching" warning for my jekyll blog. I have consulted the HTML5 boilerplate github and cloned the project. I then copied over the .htaccess file into the root directory of my own blog, however, when I retest my website, I still have the same browser caching score. I have confirmed that there is language related to expiration dates within the .htaccess file. My github project can be found here:
https://github.com/thedatasleuth/thedatasleuth.github.io
.htaccess is for an Apache web server. Github pages is not an Apache web server and whatever server technology it is, they don't allow you to adjust those settings.
Related
I have just inherited a massive old HTML site that I want to track on Google analytics. It's nearly a 1000 pages of good old '90s html.
I've been running a web server for many years but am not a coder in any particular language although I do edit my PHP config files and my HTML files, install and configure modules in Mediawiki, phpBB and Drupal. I am currently on Svr2016, IIS10. For this HTML site, how would I include the Google tag (or any other tracking tag) in the header on every page served from my IIS console?
I need a pretty cut and paste or point and click solution.
Assuming you’re using IIS and have SSI enabled (SSI= server side include).
I would create an include file (server side include - could be .shtml) and paste the google analytics or tracking.
Then, I would find a file such as footer that’s used by all the other files and include it.
Or maybe put it other common files like navigation that’s used site-wide.
See sample use/issues.
https://serverfault.com/questions/244352/why-wont-ssi-work-in-iis
I've used a boilerplate to create a website and I've tested it on https://testmysite.thinkwithgoogle.com/ and it said I have to leverage my browser cache. After doing some research, it says I have to add this tweak in .htaccess. The issue is that this tweak already exist in boilerplate .htaccess so I'm not really sure why the speed checker said I should be leveraging my browser cache?
Any insights why it gives this error?
Update: I've tested it on gtmetrix, it says I have to leverage browser cache of bunch of img, js, and css files. I've checked .htaccess files and there the expires tag of all the mentioned above files. Still no clue why it keep giving that note?
After doing extensive research, I found that git hub web pages don't allow for server configuration, so using .htaccess wouldn't leverage my browser cache. Hoping that github would solve this issue.
I have a site up and running using Drupal.I use a web-hosting service, that uses Plesk 12 panel.Recently I decided to add a subdomain for the mobile version of my site.So I created a subdomain inside Plesk, pointed it to www.mydomain.com and named it m.mydomain.com.My desktop site is in httpdocs folder and my mobile version in m.mydomain.com folder.Then I added redirection to my mobile site when a mobile device is detected.
The problem is that m.mydomain.com does not show images because they are uploaded in httpdocs/sites/default/files which is my desktop site.Is there a way to access that folder from my subdomain?I have no access to http config files.Is there a way to do this from .htaccess file of my sub-domain?
*UPDATE
My structure is:
root
-----httpdocs
----------desktop site folder
-----------------desktop site files
----------mobile site folder
-----------------mobile site files
----------images
The best option I can think of is to use the Drupal module Domain Access.
From the module's page:
The Domain Access project is a suite of modules that provide tools for running a group of affiliated sites from one Drupal installation and a single shared database.
Using that, you should be able to apply a different theme to the subdomain site than what you are doing with your main domain. You could use JavaScript or the like to redirect people to the subdomain.
The second option is that there is already a module called Mobile Tools that allow you to change theme and other settings for mobile devices. The description for that module page is as follows:
The Mobile Tools module provides Drupal developers with some tools to assist in making adjustments to your site based on the visitor's device.
It was mentioned in this question, "How to redirect users to mobile site". However, I must caution you against using the Mobile Tools module as it is only in development, and the last contribution to it was 3 years ago. (Plus they have a big warning on their module page that says "Do not use on production".)
Either of these modules should be able to get you started in the right direction.
Instead of doing a redirect, I would place the images in a folder accessible to both systems. My understanding is right now you have something similar to...
site1/images
site2
If you move your images folder higher in your folder architecture to the same level as site1 and site2 and you update your Public file system path and Private file system path in the media configuration to be that directory it will resolve your issues. Essentially your folders will end up looking like this.
site1/
site2/
images/
I understand that .htaccess is not supported by GitHub Pages. Is there an alternative for password-protecting particular directories for websites hosted by GitHub Pages?
Although you can't use .htaccess or .conf, Github has instructions on how to use the Jekyll Redirect From plugin.
https://help.github.com/articles/redirects-on-github-pages/
The page above no longer has any mention of the plugin. The direct link to the jekyll-redirect-from plugin GitHub repo is https://github.com/jekyll/jekyll-redirect-from
"Unfortunately, GitHub pages only supports static pages. There is no way to make it execute server-side code and thus it's impossible to protect your pages with any kind of authentication scheme. If you expand further on why you need to password-protect your pages, maybe I can help you find a workaround."
Source: https://webapps.stackexchange.com/questions/35692/is-there-an-alternative-to-using-htaccess-to-password-protect-subdirectories-in
I'm using a 404.html to redirect users from old S9Y index.php to my new blog on Github Pages. Check this commit: https://github.com/lionello/lionello.github.io/commit/c175f6524a53e29aea1890c8a758afd0e8944852
This post comes out at the top of web search when you look for .htaccess redirects in github pages. I am going to answer this question in that sense.
One option is to use a DNS redirect instead. You do this by putting a file named CNAME in the project's root directory (not sure if it works in a subdirectory). Just put the redirection URL in the file. However, there are a few limitations, e.g. you can only redirect to a website's root.
The answer is yes you can now add "404.html" in you code Repository. You can display a custom 404 error page when people try to access nonexistent pages on your github site.
For more information you can refer to this link!
I am working on one website which is developed in .net. I have uploaded .htaccess files but its nt working.
Is there any new idea for that? I want that my site will be crawled with www.
Thanks
.htaccess is not just for PHP.
It's a configuration file that's read by the Apache HTTP server. So if your application is not running on that server, then that file will not have any effect.
.htaccess and PHP are orthogonal. One is a configuration file for Apache; the other is a scripting language. More than likely, you're using Microsoft's IIS server, not Apache.
The .htaccess file is a configuration file for the Apache web server, and is not dependant on PHP. It typically contains settings relating to web site user permissions, friendly URL definitions, etc.
It can, however contain configuration settings for PHP, if you have settings which are in the server's PHP.ini file that you want to override for this specific web directory.
There are many reasons why a .htaccess file may not work -- it can be broken by some very subtle things, and a faulty .htaccess file will normally cause the whole site to stop working completely, regardless of what the error is.
In this case, the browser will usually simply show an error 500, without much useful information to help you debug it. But there will be more helpful debugging data in the server error log.
If you still struggle with it, you should post your .htaccess file here so we can help you debug it.
However, as #Tomalk says, if you're developing a .NET site then you're probably not using an Apache web server; you're probably using an IIS server. In that case, there are entirely different ways of setting the configuration for the server, and it won't know what to do with .htaccess file.