Click here to Skip to main content
13,047,567 members (58,594 online)
Rate this:
Please Sign up or sign in to vote.

One of my mate asked me if it's a good solution to have a virtual folders in a url ?

Basically, they are working on a developing CMS system for articles website (They publish many articles).

For instance -

Here news and sports folder are virtual.

This link can also work as -


Pros -

1.) There is no need to create a folder or category for an article.
2.) They only need to name the virtual directory by whatever name they like. In future, if admin wants to create all together a new menu system, they can change it. They do not have to create a folder or directory for the article to exist.
3.) This way url can be very SEO friendly.

Cons -

1.) They can not have the two pages/articles same same.

For instance - they can not create another index.php page in this scenario.

So if admin tries to create a new page/article by name index.php - he will get an error saying "this page/article already exist. Please chose another name".

Tbh, I think this can cause lot of conflicts in the future, where they want to name two articles under different category by a same name -

For instance there are two sections - sports and technology and admin wants to create -

and similary,

They can not create car.php again, even if they want to place it under different category as category is all virtual.

I might be completely wrong, and may be they are suggesting a good solution. What are your thoughts about it? Is this the way to go?

Posted 21-Feb-13 23:43pm
Comments 12-Jun-14 6:47am
Dear Andy,
This kind of URLs help when URL rewriting is implemented in your website. Support you have two URLs and

The original page in your website might by anyhting like xyz.php but, using this technique you are passing some query string parameters to your web server such as- Sports and Car in first URL and technology and car in second URL. You do not have to write something like- and

So, when a user hits any one of these URLs, physically a single page will server the requests from both URLs but, you will be able to change the content according to the URL.

And, lastly it is also SEO friendly and easy to remember.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Have you consider URL Rewrite[^]? or are you talking about the URL Rewrite here?

You can map querystrings to a folder path. and then pull the data based on the querystring and show it to the user.


There are two separate contents for 'Sorts-Car' and 'Tech-Car'

you can add a rewrite rule which makes (on the web browser)

to (on the web server)

and then on the index.php, pull the contents from database based on the parameters. This way you do not need separate index.php for different category. and you can add as many dynamic category and sub-category as you want.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 22 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100