Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 2 down vote accepted

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.

share|improve this answer

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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