I need to create a static version of a Joomla website. I'm using wget to download files. But the downloaded files have a base url that point to the live site.
If I remove the tag, then the local files become a mess, since references to css, javascript etc. start with a slash and Chrome errors with "Not allowed to load local resource"
Here some source code from the downloaded site:
<base href="http://www.example.com/" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Home - My Site</title>
<link href="/templates/mytemplate/favicon.ico" rel="shortcut icon" type="image/vnd.microsoft.icon" />
<link href="/templates/mytemplate/css/template.css" rel="stylesheet" type="text/css" />
<link href="/templates/mytemplate/css/custom.css" rel="stylesheet" type="text/css" />
<script src="/templates/mytemplate/js/template.js" type="text/javascript"></script>
Does anyone have an idea how to create a good local static copy of a site? What setting am I maybe missing in wget?
To make a really static copy of a site, you need to specify both -k (--convert-links) and -p (--page-requisites):
$ cd <target-dir>
$ wget -k -p http://www.example.com
$ cd www.example.com
$ firefox index.html
This is not Joomla specific, though.
Related
I downloaded my laravel project from live serve (shared hosting) to local hosting because I want to make some changed in the code. I added a new index.php file to the public folder and run composer update and composer install commands and managed to run the project on local server (I use Laragon server on windwos). However, the project can not upload the resource. The resource are located in the public floder and linked using {{asset}} function and {{assetversion}} methods. Honestly, I do not know about the use of version. The code in like that
<link rel="stylesheet" href="{{ asset('public/frontend/infixlmstheme') }}/css/fontawesome.css{{assetVersion()}} ">
<link rel="stylesheet" href="{{asset('public/backend/css/themify-icons.css')}}{{assetVersion()}}"/>
<link rel="stylesheet" href="{{ asset('public/frontend/infixlmstheme') }}/css/flaticon.css{{assetVersion()}}">
<link rel="stylesheet" href="{{ asset('public/frontend/infixlmstheme') }}/css/nice-select.css{{assetVersion()}}">
<link rel="stylesheet" href="{{ asset('public/frontend/infixlmstheme') }}/css/notification.css{{assetVersion()}}">
<link rel="stylesheet" href="{{ asset('public/frontend/infixlmstheme/css/mega_menu.css') }}">
When I check the path in chrom dev tools, the link points to the right folder (except the version in not in the file name). such as
<link rel="stylesheet" href="http://127.0.0.1:8000/public/frontend/infixlmstheme/css/fontawesome.css?v=5.0.0 ">
and the folder in with same path starting from public.
However, the recourse is not connected and the error massage is shown in the attached image fro chrom dev tools.
I appreciate you help guys and thank you in advance for your time and expertise.
I have assempution the error is from {{assetversion}} but I could not find the version in the file name. I do not know a lot about the frontend how the asset version work.
I am using the following line to add the CSS file:
<link href="public/css/blog.css" rel="stylesheet">
And in source file I see it's showing:
<link href="public/css/blog.css" rel="stylesheet">
but somehow laravel can't find this CSS file!
Even I have used following line:
<link href="{{ URL::asset('public/css/blog.css') }}" rel="stylesheet" type="text/css" >
and in source file it's showing:
<link href="http://localhost:8000/public/css/blog.css" rel="stylesheet" type="text/css" >
But no luck!. it's saying:
Sorry, the page you are looking for could not be found.
You don't need to reference the public folder explicitely, because this is already the web root (at least it is when the web server is configured correctly, also for security reasons). In other words, the browser only sees the content of the public directory - everything else is pulled in by the framework.
This means <link href="css/blog.css" rel="stylesheet"> should be enough. Alternatively, you can also go for <link href="{{ asset('css/blog.css') }}" rel="stylesheet">.
Try without public in your link:
<link href="/css/blog.css" rel="stylesheet">
and also check that blog.css exists in the folder: public/css
Your webserver should use Laravel's public folder as root folder.
I have a site that is www.project.example.com/apps/myapp and I have various javascript and css files linked like this
<link rel="stylesheet" type="text/css" href="{{asset('/css/app.css')}}"/>
<link rel="stylesheet" type="text/css" href="{{asset('/css/myapp.css')}}"/>
<script type="text/javascript" src="{{asset('js/app.js')}}"></script>
<script type="text/javascript" src="{{asset('js/vendor.js')}}"></script>
But I keep getting a 404 not found error because its looking for the files in www.project.example.com/css for example.. Its not even looking in the assets folder
How can I fix this without having to change the path for every css and javascript file?
fixed it. had to set base href in index.php and use relative links
<base href="/apps/myapp/"
<link rel="stylesheet" type="text/css" href="css/app.css'"/>
<link rel="stylesheet" type="text/css" href="css/myapp.css"/>
i am deploying my project to shared hosting now. But i found that all the css file seem like not in correct directory. For example my original code is <link href="{{ asset('intro/css/style.css') }}" rel="stylesheet" type="text/css">
In server i need to change it to
<link href="public/intro/css/style.css" rel="stylesheet" type="text/css"> in order to make it work.
But i having thousand of line need to change if i had to update all.
Is there others way to do it?
I am using Cpanel and my file is located in public_html.
Try this
<link href="{{URL:: asset('intro/css/style.css') }}" rel="stylesheet" type="text/css">
My css file is not working. I store my css file public_html/css/main.css.
But it's not working.
Where should i put this?
You need to call your css inside <head> tag and specify the path. Maybe you can put the css inside public/css directory. Your link should look like below:
<head>
<link rel="stylesheet" type="text/css" href="/css/main.css">
</head>
Look in your index.html file for the line:
<head>
<link rel="stylesheet" type="text/css" href="FILENAME.css">
</head>
The href is the link to the .css file. Make sure the path is correct.