Mobile app version of vmapp.org
Login or Join
Eichhorn148

: Is there any real tangible benefit from replacing many one-file directories with many files in one directory? I run an information repository website, catering specifically to CPUs, and before

@Eichhorn148

Posted in: #Apache #Directory #DirectoryListing #Seo #WebDevelopment

I run an information repository website, catering specifically to CPUs, and before the website gets too large, I would like to know if the current setup is going to give me trouble in the future.

Say I have a directory for Skylake-based Intel Core i7 and legacy Pentium processors. At the moment, this is how the directory structure looks:

/core-i7/
/i7-6000/
/i7-6700/
index.php
/i7-6700k/
index.php
/i7-6700t/
index.php
index.php
index.php

/pentium-legacy/
/75-mhz/
index.php
/100-mhz-15-w/
index.php
/100-mhz-17-w/
index.php
/133-mhz/
index.php
index.php


As you can see, the actual directories for each model are one-file directories. And this applies to all processors in the database. As the database expands, this will of course grow considerably (I estimate around 5,000 models), so before any of that takes place, I'd like to know if the following method would be better for any reasons at all, be it server-related, SEO-related, whatever you think will impact the website in any way.

Okay, here is the structure I'm thinking about using:

/core-i7/
/i7-6000/
i7-6700.php
i7-6700k.php
i7-6700t.php
index.php
index.php

/pentium-legacy/
75.php
100-15w.php
100-17w.php
133.php
index.php


Of course, I can already see at least one benefit from this method, and that is with so many index.php files open in Notepad++, it's difficult to know which one belongs to what model until you get to it and check the path, but is there any benefit for the website?

The website's content is mostly a year old, so that's why I bring SEO into this. It would likely take a while for Google to fix the search result URLs. I'm willing to accept this if there are any other greater benefits.

Edit

I'm assuming that the file system is ext3, although I'm not 100% sure.

Second Edit

Here is the website in question, should you wish to see the real example.

Many thanks.

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Eichhorn148

2 Comments

Sorted by latest first Latest Oldest Best

 

@Annie201

I would like to know if the current setup is going to give me trouble in the future.


You'll need to compare your setup with the filesystem the server uses and what you already have stored on the server. Some file systems may have a limit on the number of directories that can be made in one folder, but if you are only doing a few folders, this should not be an issue. A work-around to this can be to map your URL's to a script, and this can easily be done with apache's mod_rewrite module. For example, this code for mod_rewrite works:

RewriteRule ^(.*)$ /runscript.php?spec=


What this rule does is executes /runscript.php on your server passing the folder name as the parameter value for "spec". then you can use your script to determine the value and display the appropriate content all from one file. That way, you won't need to worry about creating separate folders or files, plus it's easier to maintain.

In your PHP file, you can have the following:

<?php
$spec=$_GET['spec'];

if ($spec=="486_machine"){
echo "This is the page about the 486 PC.";
}

if ($spec=="pentium"){
echo "This is the page about the pentium processor";
}

?>


If you try my script and you go to the URL example.com/pentium, then you'll see "This is the page about the pentium processor". Tweak the script well enough and you'll be able to share info about all processors.

10% popularity Vote Up Vote Down


 

@Jamie184

As far as the full URL is concerned, you need to look at it in four parts.

[protocol://domain name][path][file name.extension][parameters]

The ranking of each part is from left to right in importance with an emphasis on the domain name and the path. File names and parameters count for little these days. Google seemed to go through phases finally deciding that the domain name and path offer the best semantic clues to what a web pages topic is about. The only semantic clue greater than the domain name and path is any link and link text to the page. After that, on-page factors become important.

You should not repeat anything. As well, where it applies, each path should read like a sentence. That may not be possible in your case. It is important to give as many semantic clues as you can.

Updating your example:

/core-i7/
index.php
/i7-6700/
index.php
/i7-6700k/
index.php
/i7-6700t/
index.php


Adding more semantic clues

/processor/core-i7/
index.php
/i7-6700/
index.php
/i7-6700k/
index.php
/i7-6700t/
index.php


I would add that index.php does not add any semantic value. You can rename the file, of course, however, I am a big fan of URLs such as example.com/processor/core-i7/ where the index.php is not linked to and does not show.

For clues as to how to organize this better, read: Well structured URLs vs. URLs optimized for SEO

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme