Can I move the following pages so that they sit ‘under’ our main ranking page - For example:
https://www.mywebsite.com.au/otherpage will become https://www.mywebsite.com.au/mainpage/otherpage
Yes, why not…
When you call a page from the main page in a link like <a href="otherpage">otherpage</a>
Just use it this way: <a href="mainpage/otherpage">otherpage</a>
And, in PHP something like this: <?PHP header("LOCATION: mainpage/otherpage"); ?>
Easy to do…
Thank you for your reply
I mean I have this existing page under /public_html/sole-trader. Now I want to make this page under /public_html/professional-traders/sole-trader or https://www.mywebsite.com/sole-trader under https://www.mywebsite.com/professional-traders/sole-trader.
Well, in the folder public_html, create a new folder named professional-traders.
Then, in the folder now public_html/professional-traders , create a folder named sole-trader.
Then, move your files to it.
Now if you mean you just want the name in the URL that is displayed on the browser to change without really moving files, that would be done with a “rewrite” command in your .htaccess file in the root folder of the site. Hope this helps!
Yes thank you! It really helps. However some images are missing since it’s in different folder. Is there a way I can fetch the files from public_html without moving the images folder and the css?
Yes! You must understand folder structure to handle this. Let’s say it is set up like this:
public_html
-----> images
-----> css
-----> professional-traders
If you have a file inside of the professional-traders folder and want to access a folder like images,
you have to back up one level before accessing it. Let’s say you want to load images/icon.png from the images folder. You can not use src=“images/icon.png” because the images folder is not inside the current folder of professional-traders.
To solve that problem, you can either use the root folder to start with like this:
<img src="/images/icon.png">
The starting slash means to start at the ROOT folder then wherever. In this case the public_html folder.
Or, you can BACK-UP one level using two periods like this:
<img src="../images/icon.png">
Since we are in the root or public_html folder and inside the professional -traders folder which means
public_html/professional-traders/ , we would need to just back up one level to get to the root and then access the images folder.
Different programmers like different ways to handle this issue. If all of your images and CSS is always in folders in the root of the site, it is easy to just use the starting slash to indicate the root, then the folder you want to use.
Hope this explains it enough. Good luck!
Thank you so much! I will try to do this and hope it will work.
A further thought for you to think about…
Often you use a server for testing extra sites. Just place one into a folder and not tell anyone about the folder name and test away… So, if you use some library it is nice to have it in the root folder. But, you need to group them so you will always remember where they are. One way is to place all CSS code for all your pages and sites in one folder named CSS in the root folder. Then, another root folder named LIB for all the libraries you need. And, another for IMAGES. Also, perhaps a root folder named JS for all the Javascript and JQuery libraries. And, inside each of these you can have more sub-folders as needed.
So, for libraries, you might have an email library such as PHPmailer, a PDF creator such as phpPDF and any other library and all would be stuff into the lib folder. Then, you can always access them from anywhere in the server with “/lib/lib-name/” “/images/icons/” , “/images/profiles”, etc…
Just to make you think ahead for the future… Sorry if it was too much info…