Redirection only happening in FF, Safari - .htaccess

It is a bit weird what I've been experiencing on a project I cloned from github.
I setup my vagrant then access the local IP address I specified for it :
http://4.4.4.16
On chrome => I'm getting 200 and the front page is displayed
On Safari and Firefox => I'm getting 320 and instantly redirected to scripts page on the web.
I investigated a bit and found a the following redirection implemented on the .htaccess
RewriteCond %{REMOTE_ADDR} !^127.0.0.1$
RewriteRule ^(.*)$ http://www.website-of-script.com/ [L]
I removed it and then everything went back to normal, FF and Safari displays now the page on local dev.
But I still don't understand why would Chrome jumps the redirection although it's basically clear to redirect all localhost while Safari and Firefox don't.

Related

Server responds with a 403 error after browser update

I have a site that plays music. The user can listen to a song only by navigating to a specific site on the server that retrieves the music file and presents it to the user through the audio html tag. In order to prevent the users from accessing directly the song's address I implemented a year ago the following htaccess script:
Header set Access-Control-Allow-Origin "http://myexamplesite.000webhostapp.com/"
ErrorDocument 403 /error404.php
ErrorDocument 404 /error404.php
Options -Indexes
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://(myexamplesite\.)?000webhostapp [NC]
RewriteCond %{HTTP_REFERER} !^http://(myexamplesite\.)?000webhostapp.*$ [NC]
RewriteRule \.(mp3|png|jpg)$ - [F]
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http(s)?://(www.)?(myexamplesite.000webhostapp.com)(/)?.*$ [NC]
RewriteRule .*.(.zip|.rar|.exe|.mp3|.pdf|.swf|.psd)$ http://myexamplesite.000webhostapp.com/error404.php [R,NC]
This script has been working flawlessly until a week ago, when chrome and mozilla updated and since then I see the error below on the chrome developer tools.
The browser cannot load any media such as images, documents and music files as described in the script above.
When I remove the script the problem is resolved but by doing so lets the users access and hotlink my resources with great ease.
The most confusing part is that mobile browsers have not any problem while desktop ones show errors. For example the updated chrome and firefox mobile browsers can access the site normally with all those resources without the issues dealt on desktop browsers.
I have tested if the problem appears in various computers and it still appears.
I believe that the problem shows up in newly updated browsers because the problem does not show up on elder versions of mozilla firefox desktop browser (version 47).
What causes this problem? How can I deal with it? I need a solution that does not override the main purpose of the htaccess script; to not allow direct access and hotlinking to sensitive media (images, pdf documents and mp3 files).

Website Has SSL Issue, Shows in IE and Safari but Not Chrome or irefox

I have a website a company I freelance for took over and since it was transferred their site went down. The website is www.baseline-enserv.com.
For me, it shows up fine in Internet Explorer and safari but in Chrome and Firefox it's redirecting it to an https:// of which it is not.
I have checked the htaccess and it had a https redirect in there which i've removed. I did a database search and didn't find any URL's with https and I checked the wordpress settings for the site itself and it's set to http://.
I can't figure out where else to look to find out what's causing it to redirect. I even checked to see if there was a DNS setting that somehow did it but there is none.
It should NOT be redirecting to https but should be http only.
I also ran a test on geopeeker.com and to my surprise it checks out in all locations, but it may be using the same browser that i'm using that shows up fine.
I also have an account for browserstack so I have tested it on there and it checked out and loaded fine in Firefox 47 and 45, Windows 8 as well as Chrome 50 and 51.
It seems as if it's a caching issue but when I clear my cache and cookies it still doesn't work.
Thanks!
This is all that resides in the htaccess by the way.
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /site/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /site/index.php [L]
</IfModule>
# END WordPress
They had the site installed into a site folder in the root.
It is definitely a cache mechanise problem. Your site used to have a Permeant Redirect (301) rule in .htaccess. And that is being cached by the browser.
In Chrome, I don't think that "Clear browsing data" will be helpful in this case. There are some workarounds, I think that might help:
For Chrome:
Try to use incognito mode for testing
Try to open the inspector, and go to Settings (three dots on the right side) => check Disable cache (while DevTools is open), and reload the page.
For Firefox:
Private tab will work fine
Or you manually check cache file to make sure by accessing "about:cache"
If none of above work, try to put some random query string after the url for testing. For example:
www.baseline-enserv.com/?test
If it doesn't work too, I think you have to try it out on other machine/device. But after all, that cache will not last for long. And it will soon be cleaned. So, if it is no urgent, just sit back and get some coffee. And get back to it later.
Hope that helps!

Chrome won't redirect through htaccess

I want to redirect all urls without www to the www-version:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.domain\.tld$ [NC]
RewriteRule ^(.*)$ http://www.domain.tld/$1 [R=301,L]
that works for every browser except google chrome with subfolders. That means http://domain.tld is redirected to http://www.domain.tld like it should but when I want to access http://domain.tld/subfolder I get a 'ERR_NAME_NOT_RESOLVED' error in chrome.
Firefox, IE, Safari are working.
I have no definite answer for you, but these few hint may help you :
idea 1
Chrome uses google own's DNS, so it might be that it is trying to reach directly the ip host known as www.domain.tld for wich it does'nt find a record.
Idea 2
You might want to install fiddler and run a trace to see exactly what is exchanged between chrome and the internet. This way you'll know if your apache conf is firing the redirect correctly.
I tried typing both adresses in chrome directly : none is recognized by the omnibar (which suggests to me an issue with google dns mirrors)

.htaccess files keeps redirecting in firefox

I modified my .htaccess file to prevent hotlinking. After that I reversed the change. Now in firefox it is still redirecting from domainname.com/imagedir/image1.jpg to domainname.com when I enter the URL directly. In other browsers it is working fine.

htaccess problem with Chrome, but not Safari?

I have a very simple .htaccess file set up to redirect a 404 to a php script:
ErrorDocument 404 /404.php
This works as expected in Safari, but does not work in Google Chrome (on a Mac or a PC).
I have also put a 404.htm file to see if the php script was the problem, but had the same results.
Why would Chrome have a different experience over Safari for this? I expected the .htaccess file to be a server-side redirect, so there shouldn't be any browser issues.
(All cache was cleared on all browsers before testing as well)
Chrome displays specific error messages for 404 an such, you'll have to disable it manually in its options:
http://www.google.com/support/chrome/bin/answer.py?answer=95671

Resources