Custom home page with iWeb - html

How can I create a custom 'skin-style' homepage for a website published in iWeb?
The current root URL mydomain.com redirects to mydomain.com/myiWebsite/welcome.html. I want to create a new homepage at the root URL, which has links to the other published pages on the site. I guess this will mean telling iWeb to stop redirecting from the root?

Do you have access to the actual publishing directory on the server? is the server your computer or do you actually host these files somewhere else? Does iWeb just upload the files you create in iWeb to the server you specify?
Most likely, iWeb has created an index.html file at mydomain.com that has an auto-redirect header in it. It is either that, or there is a server-level (.htaccess) config file that is telling all requests to mydomain.com to go to the welcome page.
In either situation, telling the server/html page to do something else probably won't fix the problem if you continue to use iWeb as your method of publishing to the server, since iWeb expects your pages to behave the way iWeb sets them up to behave. Changing one thing could very easily break all of the other parts of your pages iWeb has created.
I hate to be the guy that says "You should just do it all from scratch and be hardcore" but unless iWeb has a preference for making the change within iWeb, you probably have to choose between iWeb and how it does things or something else entirely.

Related

Web development with PuTTY and SSH: Why is the webpage I'm trying to change the code for linking to a deleted directory and not updating?

This is my first time trying web development and creating an actual website (not just a page on Repl or independent html/css page). I have a domain name, and the website connected to it that I'm trying to edit previously had some code on it.
I'm trying to use PuTTY and SSH to transfer the html and css files I want to the remote location.
However, this is what the user point-of-view looks like right now
I'm really confused because gittwo is a directory (with the html + css files I want) that I already deleted. I'm also confused why the main website shows a link to that directory instead of just displaying the image of the website I want. Before gittwo was deleted, it was directly under the main directory where code for the website should be.
Furthermore, now that gittwo is deleted, I'm wondering why the webpage still displays a link to that directory instead of showing the new directory I created, public_html. This is how the main directory looks like on Putty Do you know why this is happening?
I'm really new to all this and I know I'm confused about more things than one here and my question probably reflects that, so please let me know what parts I could maybe clarify!

How to not load Index.html?

When a website doesn't have an index.html file, the navigator displays an auto generated page right ?
Here is an example of what I mean.
This page is very handful to explore a website, but sadly it is only displayed when there is no index.html page.
Is it possible to access such a page on a website, even though index.html exists in the folder ?
I'm using Opera, but I have tried other navigators and none of the common ones seems to do what I want ^^
Thanks for reading
This is not an auto generated page. It is directory browsing of server which can be enabled/disabled through server control panel (or using .htaccess in linux servers).
When you have default document (like index.html) in a folder, the server servs the default document instead of directory browsing. So if you want to let directory browsing when you have index.html, you have to clear the index.hmtl from the list of default documents. This can be done using IIS settings (if you have access to server) or through hosting control panel in website settings (in shared hostings) (or by direct editing of web.config or .htaccess)
the navigator displays an auto generated page
No. This has nothing to do with the browser. The browser displays whatever the server returns. Nothing more, nothing less.
What you're seeing on that link is from the Apache web server. That web server is configured to (and can be configured not to) return a generated directory listing when no default response can be determined.
The "default response" might be index.html, or default.html, or literally anything that the web server is configured to look for by default. (Those are just, well, the common defaults.)
In many modern web applications the concept of a "page" doesn't even really mean the same thing, because things like MVC frameworks don't just browse directories for .html files but instead examine requested routes and generate responses from code.
Is it possible to access such a page on a website, eventho index.html exist in the folder ?
No. Because that "page" doesn't exist. The web server returned that to you because it was configured to. If it's not configured to then that data doesn't exist.

how to load HTML pages, from a location different from root, on the same server?

I am making my first web site with OSX; this is an internal website for my company.
When the server start, I load pages from a different location, from the one that OSX server used to create my template site (because I do redirects that go on the same IP address, so the pages of the redirect obscure the ones from OSX server). These pages are served by a product called Buildbot (a CI server).
Now, I load the main page from the python directory on my computer, and I would like to avoid to get all the pages for the server there, to not mix them up with the buildbot pages; so I am trying to use the directory that OSX server created for me.
The issue thou, is that I do not know how to link pages...HTML is something that I forgot with time; but I remember that each site starts from a root directory, so the computer is protected by outsiders that may try to force it.
Now, I assume that my root is where the start page is loaded from (in my case is /Library/Python/2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/status/web/templates/), so if I use an href to link to another page, I can just access to this tree.
Which means that my website should be in a folder in this path? I can't seem to access the site where OSX server created the website resource (which in my case is Library/Server/Web/Data/Sites/mySite/).
Has been so long since when I used HTML, so I am quite rusty on the topic, and would appreciate a lot any kind of hint. The site will not be available outside our internal network, so I simply need to link pages and resources scattered on my server HD, and put them on web pages.
Here's how I understand:
Let's say your web root is /root, but you want to have a href to an html file in /dog, for example. Is this correct?
Assuming so, you cannot link an HTML file that is not in the web root, as the browser needs to be able to access it. If you were using a server-side programming language you could do this, but not with HTML.

How do I structure modx pages so they aren't all at the root URL, whilst being organised in a folder in the manager?

I'm developing my site in modx, and have some custom error pages that I want to group in a folder called "error", and I want them to only be accessible through domain.com/error/page.html. I've already placed the custom error pages in a container called error, which basically looks like the image below.
Only the pages are still only accessible from the root (so from domain.com/page.html), even though they are now in the "error" container. How do I change it so that when people see my error pages, they'll see the url: "domain.com/error/page.html"? Does anyone know how to do this?
p.s.: I've already figured out that I can influence the url of a page by typing the desired url in its "alias"-field. So an alias of "error/page" would mean it can be found at "domain.com/error/page.html".
But the weird thing is that this no longer works when I put the pages in an "error" folder. When I do that I can access the folder itself through domain.com/error, but no longer the pages in the folder at domain.com/error/page.html
Look in your system settings for the error page & access denied page, just set those to the IDs of the custom pages you have created. If you want custom pages for other error codes, you may have to use some redirect rules in an htaccess or apache config file. Some of them will probably never work [like 500 errors] in which case you would have to use a static html file & the server configuration to point to it.
as for setting the path - you will have to set your furls [more system settings] to "use friendly alias path'
also - clear your cache, with modx when in doubt clear the cache...

web-development: how do you usually handle the "under costruction" page"?

I was wondering what's the best way to switch a website to a temporary "under costruction" page and switch it back to the new version.
For example, in a website, my customer decided to switch from Joomla to Drupal and I had to create a subfolder for the new CMS, and then move all the content to the root folder.
1) Moving all the content back to the root folder always create some problems with file permissions, links, etc...
2) Creating a rewrite rule in .htaccess or forward with php is not a solution because another url is shown including the top folder.
3) Many host services do not allow to change the root directory, so this is not an option since I don't have access to apache config file.
Thanks
Update: I can maybe forward only the domain (i.e. www.example.com) and leave the ip on the root folder (i.e. 123.24.214.22), so the access is finally different for me and other people? Can I do this in .htaccess file ?
One thing to consider is you don't want search engines to cache your under construction page - and you also don't want them to drop your homepage from the search index either (Hence just adding a "noindex" meta tag isn't the perfect solution).
A good way to deal with this is do a 302 redirect (temporarily moved) from your homepage to your under construction page - that way the search engine does not cache your homepage as an under construction page, does not index your under construction page (assuming it has a NOINDEX meta tag), and does not drop your homepage from the search index either.
One way would be the use of an include on your template page.
When you want the construction page to show, you set a redirect in the include to take all traffic to the construction page.
When you are done your remove the redirect.
What about hijacking your index.php file?
Something simple, along the lines of
<?php
if (SITE_OFFLINE)
include 'under_construction.html';
else
//normal content of your index page
?>
where you would naturally define SITE_OFFLINE in an appropriate place for your needs.
What I did when I used PHP for websites was to configure Apache to direct all requests to a front controller. You then would have full access to all requests no matter where they are pointing to. Then in your front controller (PHP file, static html file, etc.), you would do whatever you need to do there.
I believe you need to configure pathinfo in Apache and some other settings, it has been about 3 years since I have used that approach. But, this approach is also good for developing your own CMS or application so that you have full control over security.
You have to do something similar to this:
http://www.phpwact.org/pattern/front_controller
I am looking for more details, I know my configuration had more to it than that.
This is part of what I'm looking for too:
http://httpd.apache.org/docs/2.0/mod/core.html
Enabling path_info passes path information to the script, so all requests now go through a single point of entry. Let me find my configuration, I know vaguely how this works, but I'm sure it looks like a lot of hand waving.
Also, keep in mind that because all requests are going through this single PHP file, you are responsible for serving images, JavaScript, CSS, etc. So, if a requests is coming in for /css/default.css, that will go through your php script (index.php, most likely), then you'll need to determine how to handle the request. Serving static files is trivial, but it is a little more work.
If you don't want to go that route, you could possibly do something with mod_rewrite so that it only looks for .html, .htm pages or however you have your site configured. For me, I don't do extensions, so that made my regex a little more difficult. I also wanted to secure access to all files. The path_info was the solution for me, but if you don't need that granularity, then writing a front controller might be a bit too much work.
Walter