Rel links not working when using MAMP - html

I've been developing my website using Coda2 and all of the links work perfectly (all images show up, all links work etc etc).
However I have now got MAMP and none of my links work. I think the fundamental issue is that the server doesn't recognise "../" so it can't find any of the other web pages or images!
The structure goes something like this:
index (folder) ---> everything concerning homepage
contact (folder) --> contact.html, other stuff on the web page etc etc
The rel link from index page to contact is "../contact/contact.html" which is definitely correct but when I click it, it will say "contact/contact.html" not found which I think means that the "../" part isn't recognised.
Document root is set to the index folder mentioned above.
Thanks in advance.

Related

CSS not linking to new HTML pages (Breaks on other pages except for index.html)

This is pretty much my first go at HTML and CSS. I thought I was getting a hang of it until I added more pages. I wanted each page to have the same top navigation bar format, but when I linked the same CSS Stylesheet to all of my pages it just doesn't want to work? How should I go about fixing this?
Also, somehow my google fonts link did work at first, but once I added in the pages and tried linking the single stylesheet to all the pages, it stopped working completely.
Here's what is going on:
index.html file code & link href to css
Preview of index.html/my homepage
menu.html file code & link href to the same css stylesheet
Preview of menu.html/menu page
My CSS stylesheet
The preview works with index.html, but when I navigate to the menu page, or contact page I have created through the preview, it completely breaks and doesn't have the navigation bar I created across all the pages at all.
Did I do something wrong here? I tried creating multiple CSS files and gave them different names since each page is going to look different anyways, but kept the html the same across all the other html pages and the css the same.
The reason why the css script is working for the index page only is because index.html is the only script that has the right directory to your css script. So the browser can't find the css script as a result. Remember that the other pages are not in the same location as index.html (they are in Pages instead of the root directory). All you would have you do is just change the directory path on the other scripts.
Add this on all your other scripts (excluding index.html):
<link rel="stylesheet" href="../CSS/style.css"/>
It should work after this.
Here is an example:
Your actual problem is not knowing how to navigate from one/folder to another. This link below will help you further on how to navigate around folders.
https://learn-the-web.algonquindesign.ca/topics/paths-folders/
Don't take out the files from Pages but leave them where they, all you need to do is to change the path to the different files. You'll see how I did on the screenshots above.
If I had more time I would go more in detail but this should be sufficient info for you to solve the problem and understand what mistakes you made. I hope this helps.

Internal Links in HTML

I have a lot of internal links I want to use for the first website I'm building. It works great when I run it locally but none of the internal links work when on the actual site. For example, here is one internal link I'm using.
Read More
I understand why this doesn't work, but what link can I put there if one doesn't exist yet? I guess how do I create sub pages for my website?
Thanks in advance!
Here's simple example, You cannot use absolute path on server, but relative using .. (back to parent directory) or . (current) to link to file that you need.
If you don't have a page yet, leave it #
like Click here
You can put relative links in each page. Lets assume your site hierarchy is such:
index.html
category-a.html
category-a/page1.html
category-a/page2.html
category-b.html
category-b/page1.html
category-b/page2.html
The link from index.html to category-a.html would be:
category a
The link from category-a.html to category-a/page1.html would be:
page 1 of category a
The link from category-a/page1.html to index.html would be:
Home

Default localized index.html for pelican

I tried to find something that is similar to my problem, but I did not have success.
I'm using pelican to build a static multilanguage website and I'll use github pages to publish the content.
Being a multilanguage site (en as default) I decided to structure the output folder with separated folder for each language and use relative url to point to templates etc.. all works smoothly enough.
Just to make a first github page publish experience I used ghp-import and again all is working properly except for one little thing.
Also in localhost:8000 the default homepage, all the other pages, etc have the language tag in the url, like:
localhost:8000/en/blog
localhost:8000/it/blog
the problem is that the default homepage is:
localhost:8000 (for localhost obviously)
username.github.io (for github pages)
by landing on this page, the templates fails to load (again they are lang specific) and ever worst, all the link are broken because they do not point to any language (localhost:8000/blog does not exist)
What I would like to do is to make a redirection so that, when typing username.github.io will redirect to username.github.io/en
I did not find something suitable in the pelicanconf.py file..
is it possible?
Thanks!
Try changing your SITEURL in pelicanconf to 'username.github.io/en'
That should work but the address 'username.github.io' won't work anymore.

Why are visitors to my site following absolute links as if they're relative?

Every page on my website has a navbar with some absolute links, to pages like /archive and /atom.xml. These are present on pages like /post/post-title.
In my access logs, I'm seeing heaps of requests for paths like /post/post-title/archive and /post/post-title/atom.xml.
Assuming that I haven't just stuffed up a link somewhere (i.e., missed a slash), is there something else I might be doing wrong that's causing some clients to follow absolute links as if they're relative? Or is it just weird bots being weird?
Links that have the forward slash before it should load at any folder in your web project with the main domain name.
If you have like this:
domain.com/index.php
domain.com/archive/index.php
and both index.php files have the following:
home
archive
all the links in both files are absolute links like:
home
archive
Having relative links could be produced from two issues:
1- Having a ./ rather than / in your links. (And that is the best guess)
2- Bots understands links and love links with "/" not with "http://domain.com/"
but you might uploaded a file with a ./ link before
and bots got it and you have it recorded.
Moreover, relative links are processed inside the main folder which they are inside, for example:
Putting the following:
Other Page
archive
inside:
domain.com/archive/index.php
will leed to:
Other Page
archive

Setting Up A Html Page On A Server

I am trying to learn how to set up a html page on a server, which i have done but an index page appears, I do not want this page to appear i would rather my home page to appear.
I am only learning how to do this so i have used a free web host.
web address: http://testingmyfreewebsite.comxa.com/
My file manager looks like this
The subPages and Css folders were created by me and they contain the css and other pages to my website.
i would really like to know how to remove the index page i am open to many methods.
There are three commonly used default page names that you can use on most web servers:
index.html
index.htm
default.htm (on some Windows servers)
It's a good idea to stick with index.html or index.htm on most servers, as default.htm is most often used on Windows servers, and isn't as common as it used to be.
If you're going to put other pages inside of folders (or directories) each folder should have an index.html inside of it as well if you're relying on the url to direct the user instead of hard coding it in.