1

Is it possible to keep a different folder structure than the web structure that users see when browsing the website?

I.e. I want all my main pages to be accessed the following way: www.example.com/main-page-1/

Do I need to necessarily have each page in a separate folder, or can I keep all them in the same folder and define the structure somewhere else?

2

Yes, you can do this with URL Rewriting.

The following tutorial explains what URL rewriting is, how to get started with Apache and IIS web servers, as well as a number of useful examples.

0

More dynamically, you can use a single PHP file displaying the content of your static files. You can re-write the urls to whatever you like. By this method, you can avoid general codes (e.g. header, footer, etc) to be repeated in every single file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.