In many cases a website or web application should be accessible by multiple domains. The Problem is, that google could treat that as duplicated content (https://support.google.com/webmasters/answer/66359?hl=en) and also the trust is divided between all domains. That’s why google suggests to choose a preferred (canonical) destination URL and to redirect all requests to the a preferred domain (https://support.google.com/webmasters/answer/93633?hl=en). To achieve that, […]
Recently I had the challenge to implement crossdomain crossite Ajax calls within a htaccess protected environment (a crossover between Magento and Contao => both PHP-applications). But when the one application tried to call the other one via Ajax, I got the following error message in my developer console in Chrome and Firefox and the call didn’t took place: […]
To login to a htaccess restricted area (see http://www.ask-sheldon.com/protect-folder-via-htaccess/) via URL ist pretty simple (but often forgotten): http://user:email@example.com/protected/area Please keep in mind, that in this case username and password are transmitted as plain text. There is no encryption or something like that! So anyone who plays man-in-the-middle is able to steel your credentials easily by just […]
Apache directory listing It is possible to let the webserver deliver a list of all files for a directory whenever a user navigates to it in the browser and there is no index file (f.e. index.html). The following Apache directory listing settings can achieve this behavior via entries in a .htaccess-file placed into the respective target folder. Enable Options […]
To redirect all traffic to another URL, you can use the following Redirect-declaration in your .htaccess file. Redirect 302 / https://de.linkedin.com/in/langemarcel For example this redirects all calls to my profile domain http://www.marcel-lange.info to my linkedin account.
Sometimes you want to protect a certain folder from being accessed via Apache. You can achieve this with the following entries in your .htaccess file: Satisfy all Order deny,allow Deny from all Calls via shell are possible anyway.
Here are some nice Apache configuration entries that will increase your website performance. They can be placed in a .htaccess file: <IfModule mod_headers.c> ## # Add a Vary Accept-Encoding header for the compressed resources. If you # modify the file types above, make sure to change them here accordingly. ## Header unset ETag # Header set […]
Lets imagine you had a .htaccess authentication like that: AuthUserFile /var/www/vhosts/ask-sheldon.com/.htpasswd AuthGroupFile /dev/null AuthName “Sheldons Secret” AuthType Basic <Limit GET> require valid-user </Limit> … and a corresponding password file, you can deactivate the password prompt on 31.12.2014 at 23:59 automatically with this crontab entry: # remove htaccess password protection on 31.12.2014 MAILTO = firstname.lastname@example.org 59 […]
To use the Magento REST_AP it is necessary to set the following configurations in .htaccess: change Options +FollowSymLinks to Options +FollowSymLinks -MultiViews insert RewriteRule ^api api.php?type=rest [QSA,L] directly under #RewriteBase /magento/
The charset the Apache delivers the content with can be changed really easy. Just add the following line to the respective .htaccess or your Apache configuration to force the UTF-8 character set: AddDefaultCharset UTF-8