I have designed a website. Almost all settings are done such as port forwarding in router etc. The website is also accessed on any computer through internet using static public ip but displays text only without any css effects, images etc.
If the CSS styles, images, JS files, etc. are not displayed outside the localhost (from your IP address), it must be because when you specify the URL or location of those files, you give an absolute URL which works just for localhost.
For example, if you have
htdocs/
index.html
css/
stylesheet.css
img/
logo.jpeg
slider-1.png
slider-2.png
slider-3.png
This will work just in localhost (the computer where xampp is installed):
<link rel="stylesheet" href="http://localhost/css/stylesheet.css">
<img src="http://localhost/img/logo.jpeg">
ETC.
If you want it to work also outside your computer you should use relative paths:
<link rel="stylesheet" href="/css/stylesheet.css">
<img src="/img/logo.jpeg">
ETC.
This is because the HTML code is executed in the client side (in the person who visits your page's computer) so they can't access your files through localhost...
I hope this helps you, I was going to ask you which type of URLs do you use through the comments before answering but I can't add any comments because of my reputation :v
Related
I have a header file that links to the user dashboard that displays on all pages on my site, but if I access the link from a page such as localhost/pages/page, I have to put href="../dashboard". If I am on the root directory (such as localhost/page) then using href="dashboard" works.
Is there a simpler way than changing the directories on every single page so I can just use href="dashboard" on all pages?
Use url() helper method:
<link rel="stylesheet" href="{{url('/dashboard/plugins/bootstrap/css/bootstrap.min.css')}}">
In Laravel 5.0, I am using the helper function asset to show where different assets are ( css, js images etc. ). I am building a platform that shows different information depending on the url which means I cannot bind the asset to a url. I know in config/app.php it has 'url' => 'http://localhost' but I cannot change that because the url will not always be the same. Is there a way to set this up to handle the domain changing within the same application?
Assuming your assets are always going to be in the same relative path from the root of the site (regardless of the domain), you should just be able to output the URL to various assets as a relative URL. So, for example, if in your blade template you had something like:
<link rel="stylesheet" href="{!! asset('css/style.css') !!}">
you could replace it with a relative URL like this:
<link rel="stylesheet" href="/assets/css/style.css">
This should resolve correctly regardless of what domain you're on, and should also be fetched via HTTPS in the case that the user is on a secure page.
If you need something more complicated, you might consider setting a session('domain') variable or something that would be accessible from a global scope that could then be used to generate links to assets like:
<link rel="stylesheet" href="http://{{ session('domain') }}/assets/css/style.css">
If none of these work, then your situation is probably complicated enough that you'll need to provide us some more code before we can offer workable solutions.
Hello i have an issue with my domain and ssl, when you enter to https://www.limitx.com.mx you can see a error with a ssl encryption, your connection is encrypted with modern cryptography, how i can solve this? i dont know how to fix this issue, i hope can help me. Bes regards guys!
You have two resources on your home page that are served over HTTP (mixed content).
Mixed Content: The page at 'https://limitx.com.mx/' was loaded over
HTTPS, but requested an insecure stylesheet
'http://fonts.googleapis.com/css?family=Roboto:400,900,300,700'. This
request has been blocked; the content must be served over HTTPS.
This is coming from the main file that is generating the HTML:
<link href='fonts.googleapis.com/css?family=Roboto:500,300'; rel='stylesheet' type='text/css'>
You'll need to change this to be
<link href='https://fonts.googleapis.com/css?family=Roboto:500,300'; rel='stylesheet' type='text/css'>
Mixed Content: The page at 'https://limitx.com.mx/' was loaded over
HTTPS, but requested an insecure image
'http://limitx.panamerik.net/skin/frontend/ultimo/default/images/infortis/_shared/generic-nav/buscar.png'.
This content should also be served over HTTPS.
This is coming from https://limitx.com.mx/skin/frontend/ultimo/default/css/styles.css
.form-search .button {
...
background-image: url(http://limitx.panamerik.net/skin/frontend/ultimo/default/images/infortis/_shared/generic-nav/buscar.png);
...
}
You cannot use an HTTPS version of this URL as the certificate for http://limitx.panamerik.net/skin/frontend/ultimo/default/images/infortis/_shared/generic-nav/buscar.png does not match the host.
You can copy this file (buscar.png) locally, perhaps under skin/frontend/ultimo/default/images/infortis/_shared/generic-nav/ and change the CSS to be
.form-search .button {
...
background-image: url(../images/infortis/_shared/generic-nav/buscar.png);
...
}
Well the issue is that other objects on your page are not using ssl, do you have any embeded links that have http instead of say https? I would check those images, they are most likely the culprit. Instead of using relative paths try hardcoding all the images with https://url to image/ alright? That should fix ya up good. Nice site btw.
For your Firefox issues: https://support.mozilla.org/en-US/questions/967766
The only way for websites to "supply ownership information" would be through a secure connection and an "Extended Validation Certificate" which will cost a few hundred USD and upwards per year at the relevant certificate authorities: https://en.wikipedia.org/wiki/Extended_Validation_Certificate
Google Issues: https://support.google.com/chrome/answer/95617?p=ui_security_indicator&rd=1
Your connection to the site is encrypted, but Google Chrome has detected mixed content on the page. Be careful if you're entering information on this page. Mixed content can provide a loophole for someone to manipulate the page. This content could be third- party images or ads embedded on the page.
Internet Explorer.....doesnt see any issues at all.
I am trying to build a theme using populr.me. I downloaded few themes from github. I ran them in localhost. These theme should fetch dummy-contents from lorem ipsum, and also should fetch images. But i see nothing while I run index.html in browser locally. I was connected to internet while running themes in localhost. What is wrong??
I just responded to your email. Sounds like your problem was resolved by updating main.less reference in index.html, and changing this:
<link rel="stylesheet/less" type="text/css" href="/styles/main.less">
to this:
<link rel="stylesheet/less" type="text/css" href="styles/main.less">
Please email me if you have further questions. Thanks for using Populr!
As said here,
the easiest way to test samples is to use a local web server. If you don't use a local web server, you will need to change every src and disable local web security.
Depending on your OS, it could be python, IIS, Apache, ...
I am working with both asp and asp.net pages together. I wanted to host the application in my local iis (v5.1) but later learned about iisexpress suits my needs. But irrespective of whether I use iis 5.1 or iis express I seem to have an issue.
The asp page which I work with refers to static resources (css, javascript, etc) which reside in a different virtual directory. For e.g. a css file include would look like this.
<link rel="stylesheet" href="/common/include/style/css.css"/>
If such a thing is supposed to run from the test environment then the above url would resolve to:
http://testing/common/include/style/css.css
This is in contrast where my main application would reside. That would look something like:
http://testing/myapp/default.aspx
Now if I run iisexpress in say port 8082, and there is an inbound request like:
http://localhost:8082/common/inlcude/style/css.css
it will hit a 404 error. Is it possible to instruct iss or iis express to resolve such url (which begin with /common/...) to say http://testing/common/...
Update (May 31st 2011, 7.04 PM IST):
Been doing some research on what url rewriting is, and from the examples I have come to understand a few things. I am not sure if what I want is url re-writing, per se. Again taking the iisexpress analogy, I know there will be an inbound request uri like:
http://localhost:8082/common/inlcude/style/css.css
But I want this to be actually served by the following uri:
http://testing/common/include/style/css.css
The former uri doesn't exist in the folder which I have virtualized using iisexpress.
Do I need url re-writing here?
Further, in ASP, I have include lines like:
<!-- #include virtual="/common/include/classes/utils.asp" -->
Even these things are supposed to be resolved to their corresponding http://testing/... counterparts.
ps: I am doing all this is iis 5.1
In ASP.NET 2.0 onwards you can use the tilde operator (~) which is used to specify where your application is rooted. For example:
<link href="~/Styles/Site.css" rel="stylesheet" type="text/css" />
Would produce a relative url:
<link href="Styles/Site.css" rel="stylesheet" type="text/css" />
This works fine for ASP.NET pages.
Classic ASP and static HTML pages are a different story and one or more of the following mechanisms would have to be used:
Make everything relative. If you have a page or ASP script in the root of the site, instead of specifying /common/include/... specify common/include/.... If you have a page or ASP script in a subfolder the you'd reference your CSS by way of ../common/include/..., i.e. parent paths. The deeper the folder structure the more ../ parent paths you have so managing these relative paths can get messy. Also, although not common these days, some shared hosted servers disallow parent paths.
Prefix your CSS paths with a variable containing a path prefix. For example:
<link rel="stylesheet" href="<%=Session("RootPath")%>/common/include/style/css.css"/>
In production you'd globally set the session value RootPath to /MyApp, but for testing leave as an empty string. You could do this in Session_OnStart in your global.asa. You could also use an application wide value Application("RootPath") instead. This would only work for ASP pages.
URL Rewriting - if you have static HTML pages then URL rewriting can come to the rescue. You would rewrite the absolute url's which work on your dev PC to the path used on the production server. So basically every time you see a href="/common/... you'd rewrite to href="/myapp/common/.... IIS6 doesn't support rewriting out of the box, you'd need a third party tool such as Iconics IRF or HeliconTech's ISAPI_Rewrite3. IIS 7.x does support URL rewriting through the URLRewrite Module 2.0.