Is it bad to have multiple Index.php

(I’m sure there is a more sophisticated way to address what I’m doing, but being a newbie, I’m taking this simpler approach for now…)

Is it bad or wrong to have multiple Index.php files??

Here is my problem…

My Home Page is index.php and I have Category tabs on my Top Menu (e.g. Small Business, In the News, Free Resources, etc.)

I decided to create folders for each menu item, but want a “Landing Page” that lists everything under a Category…

I’m not sure what to call the Landing Page file or even how to handle things?! :-/

I was thinking about something like this in my Web Root…

index.php

small_business/index.php
small_business/topic01.php
small_business/topic02.php
small_business/topic03.php
:

news/index.php
news/article01.php
news/article02.php
news/article03.php
:

Would that be okay?

Right now for simplicity, every page on my website is a separate .php file (versus using fancy dynamic content with a database and all).

Thanks,

Debbie

That seems fine given the set-up.

Yup I don’t see any problem with it either. Except that I personally don’t like .php in URLs, but that’s why they’ve invented mod_rewrite :slight_smile:

What do you mean?

On my Home Page I have…

w w w.MyWebsite.com

but how could you get rid of the .php on other pages like my “Articles Landing Page”??

Debbie

Like this


# Strip .php from the URL if it's requested
RewriteCond %{THE_REQUEST} \\.php
RewriteRule ^(.*)\\.php$ http://www.example.org/$1 [L,R=permanent]

# Make the '.php' be removed from all URL's
RewriteRule ^(\\w+)$ $1.php [L]

Then you can just request news/article01, and if people request news/article01.php it will 301 redirect to news/article01 :slight_smile:

So doing it your way, my URL would look like this???

w w w.MyWebsite.com/news/article01

Is that correct?

Debbie

yup

Just to add to Scally’s suggestion … the two main reasons for not including .php in the filename are (1) it makes it easier for people to type in, and (2) if you later change your back-end systems, and start using something else instead of PHP, it’s better if you can re-map a ‘generic’ filename than one that is tied to a particular technology (yes, you can do it, it’s just a bit inelegant).

Also remember that if you have a page “index.php” in a folder “news”, you don’t want to link to website.com/news/index.php, or even website.com/news/index … keep it short and sweet, website.com/news/

I hate this debate, 95% of people viewing your site could care less about the URL, and probably about 75% won’t even know what a URL is anyway. They know, Google that is the internet and links, most average people don’t type things directly into the URL bar anyway.

I agree that there’s quite a lot of baked air involved, but still if you have the chance to create nice URLs, why not? I mean I get that people don’t want to change their URL structure of an existing site (and Matt Cutts also says it ain’t worth it), but when you start a new site and have influence on it, why not?

At the end of the day if you have to choose between example.com/products/some-nice-hat or example.com/product.php?id=5, which would you pick?

True, URLs aren’t the end all be all, but that doesn’t mean we should just forget about them completely :slight_smile:

True, most people don’t type URLs directly into the address bar, but some do. And people giving links to your site have to get those links into their pages, tweets, comments etc somehow. If you have a short, easily human readable URL, you’re less likely to get people making mistakes at all stages of the process. It’s no big deal to get it right, so why not?