Subdomain domains, sections, folders questions

Hello, after working in my local for months I’ve decided to upload and go online, I’ve learned a lot on the way but I’m lacking the online part. Its the first time I upload a website that isn’t a wordpress site, and even so I’ve only uploaded two websites in the past. In wordpress you can configure your links to look something like:

www.example.com/blog/

well a friend has lend me a small part of his hosting space so I can upload my stuff and test or use it as it is before I buy space or a name of my own.

mysubdomain.example.com

and I’ve noticed that I don’t like how my website shows sections

my index.php reads well like mysubdomain.example.com/

but how can I configure or remake my files to not look like this:

mysubdomain.example.com/section1/item1.php
or mysubdomain.example.com/section1/gallery.php

not only it shows extension of the file, but you can also access the folders directly like:

you just type in the navbar
mysubdomain.example.com/section1/
and goes to explorer type

Parent Directory.
imagegallery.php
images/
icons/
whatever/
item1.php

you can’t download the *.php files and see the code, it downloads them as htmls files. But you can download for example all the images at once if you want, and don’t even look them or download from the website. And you can see the folder structure.

What do I need to learn to make this better? and to show stuff like I want?

Thanks.

Well, first, there are free hosting sites that give you a real URL address not a subdomain.
You might want to Google those and use your own site instead of a subdomain.

But, you can alter your folder names using the file named htaccess in your root folder.
( You may need to put these files in other folders, too. Depending on the server you are using. )
What you want to study up on is " htaccess redirects or rewrites ". For the redirects, you can
make URL’s typed in as mysubdomain.something to to a set folder in your server named something else.
For rewrites, you can make the URL displayed on the browser as something else. So, someone going
to mysubdomain.example.com/section1 can be displayed as mydomain/1 or whatever you need.
Some server owners hide the folder structure this way by displaying things like mydomain/help when it really points to mysubdomain.example.com/support/help or whatever. Hiding folder structure is a common security issue for some people. You can set the folders you hide so that only the server can access them.

Lots to think about and to study for this. Google “htaccess” or “htaccess tutorial” to learn more.
Once stuck, create a new post with your problem…

1 Like

What you are trying to achieve are Clean URLs.
The website you are using it’s not a website per say, it’s just some php script files.
If you want to achieve something like mysubdomain.example.com/section1/ right out of the gate, you will have to look into Routers. More specifically look into MVC Frameworks like Symfony or Laravel (Though, i’d recommend CodeIgniter because it’s really easy to grasp the basics of MVC with that).

With a framework which has a routing system you can do stuff like: mysubdomain.example.com/blog/article/read/1 or maybe in your case mysubdomain.example.com/section1/gallery/view/image/1 and so on.

Using a framework it is much easier to achieve clean URLs.
It’s harder at the beginning but after you grasped the concept, you will be making websites in no time.

1 Like

thanks will check it.

1 Like
Sponsor our Newsletter | Privacy Policy | Terms of Service