Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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
add comment

2 Answers

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
add comment

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
add comment

Your Answer

 
discard

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.