How can I disable showing files and unstyled index page in .htaccess? - .htaccess

Okay here's my problem:
My website:
https://www.bffmatch.com/
If I go to a subdirectory that is in my website root it shows index page without any css which is very weird:
https://www.bffmatch.com/css/
And if i go to a file it shows that file:
https://www.bffmatch.com/css/match.css
The same goes for php files and whatnot
So how can i disable access to these and just redirect to my website root or something
Thanks!

The problem is here:
<link rel="stylesheet" href="css/homepage.css">
css/homepage.css is a relative path.
The browser uses the URL of the current page to make a full URL out of it.
The URL of the current page ishttps://www.bffmatch.com/css/. This makes css/homepage.css to be expanded https://www.bffmatch.com/css/css/homepage.css and it does not exist.
Use full paths for the resources and it will work:
<link rel="stylesheet" href="/index.css">
<link rel="stylesheet" href="/css/homepage.css">
<link rel="stylesheet" href="/css/profile.css">
<link rel="stylesheet" href="/css/match.css">
And so on.
Use your browser's Web Developer Tools to find out other requests that cannot be found (the server's response for them is 404 Not Found).

Related

Google font link is returning a 403 error, how can I resolve this?

I've inherited a website here which has a 403 error loading fonts. The specific font is bookman old style. It still displays in chrome and firefox, but not in safari.
https://bmdrivingschool.ca
This is the code in the head which as far as I can tell is correct to not have http or https, and the link does load if I add https to it.
<link rel="stylesheet" id="cherry-google-fonts-css" href="//fonts.googleapis.com/css?family=Montserrat%3A700%2Cregular%7CBookman+Old+Style%3A700%7CAbril+Fatface%3Aregular&subset=latin%2Clatin-ext&ver=5.0.3" type="text/css" media="all">
any help would be appreciated greatly, probably something simple I have not thought of.
Thanks!
<link id="cherry-google-fonts-css" href="//fonts.googleapis.com/css?family=Montserrat%3A700%2Cregular%7CBookman+Old+Style%3A700%7CAbril+Fatface%3Aregular&subset=latin%2Clatin-ext&ver=5.0.3" type="text/css" media="all">

serving favicon.ico from node.js

I have built a small node server using express and I want to serve index.html which contains angular app. How ever the browser sends GET request for favicon.ico. I have installed serve-favicon, however still it looks for physical file. Is there a way to override it? or from where can I find such file
The recommended way is actually just to use a link tag in your index.html:
<link rel="icon" href="/img/favicon.png">
Just change the href to link to an img in your public folder and you're good to go.
http://www.w3.org/2005/10/howto-favicon
You can use this site to get free favicon.ico
Then add your favorite favicon.ico to your html .
<link rel="icon" type="image/png" href="../images/favicon.ico" />

Azure CDN with HTTPS not working

I want to have all my static files (css,js,images) on Azure CDN, I followed this tutorial:
https://azure.microsoft.com/en-us/documentation/articles/cdn-serve-content-from-cdn-in-your-web-application/
I had in my app the following lines pointing to files in azure storage blob container:
<link href="https://stact1.blob.core.windows.net/cdn/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="https://stact1.blob.core.windows.net/cdn/Content/animate.css" rel="stylesheet" type="text/css" />
<link href="https://stact1.blob.core.windows.net/cdn/Content/style.css" rel="stylesheet" type="text/css" />
and my website renders perfectly fine
http://screencast.com/t/6m9M2s4d
However according to the tutorial I should change the url to use the CDN.
So I changed above to:
<link href="https://az780954.vo.msecnd.net/cdn/Content/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="https://az780954.vo.msecnd.net/cdn/Content/animate.css" rel="stylesheet" type="text/css" />
<link href="https://az780954.vo.msecnd.net/cdn/Content/style.css" rel="stylesheet" type="text/css" />
then everything is screwed up:
http://screencast.com/t/NEM3sDQb
If I remove the https, I see no connections done on the network tab on developer tools, If I put https, I see 403 Errors.
The problem is HTTPS is enabled on the CDN
http://screencast.com/t/RGvtj9uzq1
Given that your https links are all now working the issue you saw would have been just due to delay for the SSL configuration to propagate. All configuration changes for Azure CDN can take up to 60 minutes to propagate to all CDN POP's (i.e. CDN data centers). CDN configuration is the only item that has a delay associated with it. Content is automatically cached to individual POP's when clients makes a request for the content. If clients don't make any requests for your content no content is cached on the CDN POP's.

set directory root

I have a subdirectory for a website:
www.example.com/admin
I'm using includes throughout the site that all use the same path structure:
<link rel="stylesheet" href="assets/css/styles.css">
The stylesheets also have links in them for things like background images.
My problem is that the includes don't work in the /admin directory because they all refer to /assets/css or whatever folder that are all up one level. (Those links work fine for the main website in the root directory, but no good for the admin area.)
Anyone got any ideas how to solve this problem?
You need to either add a / to your link (making it an absolute URI instead of the relative URI that it is):
<link rel="stylesheet" href="/assets/css/styles.css">
Or you can add a URI base in your page headers:
<base href="/">

How can I output a favicon <link> in the HTML head section using JSF 2.0?

Using h:outputStylesheet I can embed CSS resources in the HTML head section, but how can I build a <link> for a favicon image resource which renders HTML like in this example:
HTML output:
<head>
...
<link rel="icon" type="image/png" href="favicon.png" />
...
</head>
The image resource is located in <web>/resources/images.
If I use direct HTML code in the JSF template like href="/resources/images/favicon.png" the resource is not found - navigating to /resources/images/favicon.png leads to the error
/resources/images/favicon.png/index.jsf
not found
(I have set index.jsf as index page in web.xml which might explain this path)
Your webapp is apparently running on a non-empty context path. The leading slash / brings you to the domain root. Use #{request.contextPath} to dynamically inline the context path.
<link rel="shortcut icon" type="image/png" href="#{request.contextPath}/resources/images/favicon.png" />
(note that I fixed the rel as well to make it crossbrowser compatible)
The href="/resources/images/favicon.png" is actually looking in the root direcotry of your server http://localhost/resources/images/favicon.png and not inside your web application directory.
Your href location will need to include the web application directory href="/webappname/resources/images/favicon.png" http://localhost/webappname/resources/images/favicon.png
If your .xhtml file is in the same directory as your resources folder then removing the forward slash at the being should work as well.
href="resources/images/favicon.png"

Resources