Help a new guy out.
I'm kinda new at programming, but over the past few months have managed to understand CSS,HTML fairly well and now I'm getting into PHP. I've found I learn a lot more by creating rather than studying.
A project I want to attempt this weekend is to make a multi-page small business website using only CSS, HTML, and PHP. I'm going to post any questions as I go onto this thread.
My first question:
I know I'll have different files like index.php for home and single.php for interior pages. How do I designate the URL location for these interior pages? In other words, how do I make single.php go to domain.com/about-us. Is there some kind of tag I need to designate to make each page located at a particular URL? What if I wanted to make another single.php template go to domain.com/contact. Could someone help me out here or point me towards a good tutorial?
For example, I know that I could make an about page <a href="about.php">About Us</a> and link to it that way, but would rather create the more common and seo friendly URLs like <a href="/about-us">About Us</a>. How do I get rid of this "page/file name" attribute and migrate to URLs site-wide?
One suggestion would be to simply use the directory structure you want. Call every page "index.php" but put them in the correct directory. For example, create a directory called "about-us" and then add an index.php file to that directory which includes the markup for your about us page. Then your navigation will work with domain.com/about-us.
I don't know what you mean by "directory."
Originally Posted by cbVision
To make an example as simple as possible, I have 3 files to make a site with 2 pages.
index.php > Home "/"
about.php > About us "about-us"
....I upload all 3 of these into my HostGator file manager for that particular domain and I'm done. Could you tell me how to use a directory in the above example?
A directory is a folder. Can you create or upload folders (directories)?
Yes I can create a folder for each page with a SEO-friendly URL.
...so that is all you do to designate a URL?
Good network on LinkedIn, I just checked.