I'm working on my site on localhost. I have my directories as follows:
My index page is located directly in the site folder as such:
../htdocs > mysite > index.php
My our-profile page is located in sub-folder called about us as such:
../htdocs > mysite > about-us > our-profile.php
I have a link on the our-profile.php page that should link back to the homepage like this: <a href=..\index.php>Home</a>.
But i keep getting a 404 - Not Found error. It uses the about-us directory as the root. So the link above tries to search for : http://localhost:8888//mysite/about-us/mysite/index.php
instead of
http://localhost:8888//mysite/index.php
How do i re-structure the links?.
EDIT:
I'm working with dreamweaver. Could it be an issue from dreamweaver?
you're using backslashes, use forward slashes
<a href=../index.php>Home</a>.
Related
Maybe really dumb question but I'm building my first site
http://iservis.info/
Im trying to build classic URL structure
I have single page "Opravy" where all devices are listed and if you clicked on certain one i want to have URL "http://iservis.info/opravy/iphone-xs-max.
So on server i have a file "opravy.html" for main page and folder "Opravy" with all sub-pages with certain devices.
enter image description here
I also have .htaccess for all .html extensions
But problem is that in nav-bar I have nav-link "Opravy" and my code is like this
<a href="opravy" class="nav-menu-link--block desktop-only w-inline-block">
But its showing error because I think its trying to link the folder and not the "opravy.html" page.
So how do I link the "opravy.html" page to nav-link but without showing .html in URL ?
Thanks a lot
Maybe use directory structure + index.html? Each index.html is rendered at the corresponding url that matches the directory structure. Something like this:
/
index.html
/../opravy
index.html
/../../iphone-xs-max
index.html
I have multiple sites in my hosting stored with the following folder structure:
ROOT-FOLDER - SITE1 example.com
SUB-FOLDER - SITE2 another-example.com
On the site in sub-folder I used html base tag in order to take advantage of relative links, however I faced some issues. The problem is that if I open the second site by its domain name it loads with the same name, but when I navigate any link it replaces the site's domain name with the one in root.
So, if any link clicked on the site, instead of getting following in address bar:
another-example.com/page1.php
I get this:
example.com/SITE2/page1.php
Could you please explain how to solve the issue?
P.S. the base tag look like this:
<base href="http://example.com/site2/" />
I am having trouble linking from a subfolder index file back to my root folder index file.
I have a logo in the nav bar of example.com/blog that I would like to have link back to example.com
I have tested various linking options for the logo image including
<a href="../index.html">
<a href="http://www.example.com">
<a href="../">
And none of them seem to work. The logo image continues to link to example.com/blog/index.html
The strange thing is that if I right click on the image and then select open in a new window/tab, then it will load example.com just fine.
I am at a complete loss.
Could this be something related to my .htaccess file?
Additional Info
I added a "Home" text link to the nav bar using the below syntax and it works perfectly.
Home
The image for some reason will not link back to the rootfolder index.html file using the same syntax. It keeps loading http://www.example.com/blog/index.html
Try using a javascript redirect
function home() {
window.location.replace("http://example.com");
}
<button onclick="home()">hi</button>
Replace http://example.com with your website.
I am very new to html. The following link works on a web hosting I am making:
Profile <br />
If I want to make a link on my local server would it be something link this?
Profile <br />
If you would like to make localhost link you should not use localhost, its enough to use folders & files only.
Here 2 link examples:
Link number 1 - localhost link
this link can be used not only in localhost, also in online server hosting, all you need is the file location you need and his extension (.php, .js, .html and more...)
assuming that file.html is inside folder1 and I would like to add link that will direct me in to it, i will write the next code:
File.html
lets assume the file i want to be redirected to is one folder back from my website, so I'll add ../ to return back and go to file.html.
This file is one folder before my website.
Link number 2 - unlocalhost link
A link who's not inside my website folder / hosting server will redirect me to other side, for example, stackoverflow.com website, if i would like to add link into stack overflow I will write the next line:
go to stackoverflow.com
I have a project directory structure like this:
proj
|__index.html
|__about_us.html
|__header.html
|__inner_folder
|__another_page.html
Now the header has a link to about_us.html file and the header is included in all the files (using jquery).
If I give a relative link in header.html as:
<a href="./about_us.html>About us</a>
it will work in the index.html page as it is at the same level as the about_us.html page. But this link in the header will not work in the another_page.html as it is not at the same level.
Now, the url on local machine for index.html is like: localhost:63342/proj/index.html
If I give the link in the header as:
About us
then the link that gets formed is localhost:63342/about_us.html (without the /proj/..) which returns a 404.
Is there a way to get the links to work on all the pages using relative paths?
I cannot use absolute paths or the project name in the path as those do not work on the remote environments where the domain is different.
Is there a way to get around this?
Thanks in advance for your responses.
If you're trying to go from another_page.html and link to a page that is one directory up, use ../ like this:
go to index.html from another_page.html
If you are linking to a page in the same directory (from index.html), you use ./ like this:
go to about_us.html from index.html