Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8858941
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:56:27+00:00 2026-06-14T14:56:27+00:00

Another very beginner website question. So looking at the file structure behind a simple

  • 0

Another very beginner website question. So looking at the file structure behind a simple php site:

File structure for PHP-based website

Folder/File Structure Conventions?

Suggest using a structure similar to:

htdocs/
    /Assets/
    /CSS
    /JS
    /func/func.php
    _newpost.php
    tags.php
    index.php

For SEO I believe that more ‘logical’ URL’s are preferred for subcategories of content.

eg. www.example.com/tags.php?t=celebrity

is less preferable to:

www.example.com/tags/celebrity

In terms of the URL – I could put the tags.php file inside htdocs/tag OR I could use mod_rewrite to give the desired effect. This said, moving .php files inside subfolders is going to cause problems when ‘including’ func/func.php and any other ‘actions’ such as _newpost.php.

Question – Is there a convention to where PHP files go? should they all be in the root? For _newpost.php – a file that carried out and action and redirects. Is there a convention to where these all should sit? Then should mod_rewrite deal with the ‘looks’ of the URL?

Many thanks – ever grateful, Matt

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T14:56:28+00:00Added an answer on June 14, 2026 at 2:56 pm

    In terms of the URL – You don’t need to place tags.php inside anywhere specific, mod_rewrite has quite a lot capability, for example the effect you desire.

    Moving into subfolders won’t cause you problems neither as long as you plan your structure well, one important thing is to define DOCUMENT_ROOT in the php.ini, so you can access your site’s root through $_SERVER[‘DOCUMENT_ROOT’]; when doing includes inside of includes, this way you won’t mess up.

    Question – There is not actually a convention as far as I know, you can organize the files the way you think is more convenient and clean/friendly for you and or future developers. although the structure you showed is pretty common.

    So yes, normally the friendly URL’s are dealt with mod_rewrite, and not with the directories, as you can set the rewrite rules as you desire.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is another probably very simple question, but I haven't been able to find
I'm trying to write a very large file to another very large file. I'm
This is very similar to another recent question: How can I return the current
In another question , the accepted answer suggested replacing a (very cheap) if statement
I have another beginner's question that hopefully someone can help with. I'm trying to
I am a C beginner, and I am writing a very simple linked-list. I
I am building a very simple website with a series of images arranged vertically
Since I am a beginner, it may be a very basic question. I am
This is a very simple question, and I apologize for being so noobish :/
I am a beginner of python and have a question, very confusing for me.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.