Jump to content

  • Log in with Facebook Log in with Twitter Log In with Google      Sign In   
  • Create Account

Subscribe to HRA Now!

 



Are you a Google Analytics enthusiast?

Share and download Custom Google Analytics Reports, dashboards and advanced segments--for FREE! 

 



 

 www.CustomReportSharing.com 

From the folks who brought you High Rankings!


Sponsored Content

 

 
 

Photo
- - - - -

Php Index Question


  • Please log in to reply
12 replies to this topic

#1 Minerva

Minerva

    HR 4

  • Active Members
  • PipPipPipPip
  • 152 posts
  • Location:Massachusetts

Posted 03 December 2004 - 05:22 PM

A client of mine has an existing site built in php, something I know absolutely nothing about. I noticed in the stats that there are lots of requests for index.html, which does not exist. In fact, more there are almost as many requests for index.html as for index.php, the real home page.

If I created a little redirect page from index.html to index.php, would that then become the default index page? (Not what we would want.) Any advice for someone is is NOT comfortable with this coding stuff????

Thanks,
Andrea

#2 robwatts

robwatts

    HR 5

  • Active Members
  • PipPipPipPipPip
  • 308 posts
  • Location:London - Hertfordshire

Posted 03 December 2004 - 05:29 PM

Hi Minerva

If its a nix box, you can use htaccess to redirect requests for index.html to index.php

If memory serves there is also a setting in your httpd.conf file that stipulates what the default files are.

It might also be the case that someone somewhere is linking to this file, hence the requests. Your log files should give you the referal data you need. if its one otr two sites, why not mail them and ask them to update their links.

Im logging off for the night here, but will dig out some code for the htaccess when I get a minute next.

If someone else can do sooner, then please oblige smile.gif

#3 leadegroot

leadegroot

    Lea de Groot

  • Active Members
  • PipPipPipPipPip
  • 488 posts
  • Location:Brisbane, Australia

Posted 03 December 2004 - 06:21 PM

I'm not sure what you want to achieve, so let me just list some options for you:
All of this requires that you have access to htaccess on this server; often it isnt on by default, so you will need to request it from the host.

- you can set the server to handle files with a .htm/.html extension as php files.
This means your files can look more 'usual' to the casual web visitor - any file ending in .html/.htm would be checked for php code.
Include the following in your .htaccess file, in the site root directory:
CODE
AddType application/x-httpd-php .html .htm

(This can also be done at the httpd.conf level, but it is quite common for shared hosting not to give access to that)

- you can set a particular index.html file to instantly go to a different file
CODE
RewriteRule  ^index.html$ /index.php [R=301,L]

(I think I got that right smile.gif)
This would mean that the 404s stop; when the visitor arrives at the index.html page, rather than get a 404, they would be instantly whisked to the index.php file.

EDIT: The above does assume you are using Apache.

HIH
Lea

#4 Randy

Randy

    Convert Me!

  • Moderator
  • 17,540 posts

Posted 03 December 2004 - 10:30 PM

Again, assuming you're on an Apache/*nix server, here's what I would use in your .htaccess file:
CODE
redirect 301 /index.html http://www.thedomain.com/index.php


Less server resources used than Rewrite Rules. Not much, but every little bit counts. Plus it'll help both with visitors and most search engine spiders.

#5 Minerva

Minerva

    HR 4

  • Active Members
  • PipPipPipPip
  • 152 posts
  • Location:Massachusetts

Posted 04 December 2004 - 09:36 AM

Thanks all. I can probably handle adding a line to the htaccess file...

Why would a site be built in php rather than html, if it's not using any kind of data base features? Every page is static. It does use what I think of as "includes" to pull in boilerplate sidebar text and navigation tables, but why use php instead of just using include files? My client remembers being told by the developers that php was just BETTER than html, but were never clear on why. The site was built simply to house the archived versions of an e-newsletter and have a few pages of resources - that's it.

-Andrea-

#6 Scottie

Scottie

    Psycho Mom

  • Admin
  • 6,293 posts
  • Location:Columbia, SC

Posted 04 December 2004 - 09:40 AM

To use includes, you have to use .php or .shtml or set the server to parse html as shtml or php. (or .asp thinking.gif )

I use php for all my sites, whether they are db driven or not, so that I can use .php for the includes files.

#7 Randy

Randy

    Convert Me!

  • Moderator
  • 17,540 posts

Posted 04 December 2004 - 10:28 AM

I use php on all of my sites as well. But that's because I'm always including basic page structure. lol.gif

Most likely the developers said that because php gives more options moving forward Andrea, and there is no downside at all. If you don't have any PHP in the page, there is nothing to pre-process so the page is delivered just as quickly as an html page would be. Plus it gives you the option of using includes as they apparently have.

Additionally, the developers may have seen a time down the road as the site grew where it would be much easier to maintain if the [url=http://www.highrankings.com/newsletter/]Newsletter Archives[/url] could be added to and retrieved from a database, rather than having to save new pages, update navigation, etc.

Lots of possible advantages, no disadvantages. And no re-writing of URLs if the site does become dynamic in the future. Probably a good decision on their part.

#8 Minerva

Minerva

    HR 4

  • Active Members
  • PipPipPipPip
  • 152 posts
  • Location:Massachusetts

Posted 04 December 2004 - 10:53 AM

I agree with all the advantages. I guess the only disadvantage is that I have to squeeze another thing in my brain (whine). Once I figure it out I'm sure I'll love it. At least I already understand the concept of includes.

-Andrea-

#9 slm64

slm64

    HR 2

  • Active Members
  • PipPip
  • 23 posts
  • Location:Christchurch, NZ

Posted 07 December 2004 - 03:42 PM

Hi Minerva,

In case a little encouragement helps - I have just dipped my toes into PHP in order to deal with a feedback form and it didn't kill me, although it was a bit frustrating at times (stupid mistakes on my part, not quirks in PHP). There are lots of good introductory books out there too, and a plethora of web resources so you're not alone at all.

#10 Minerva

Minerva

    HR 4

  • Active Members
  • PipPipPipPip
  • 152 posts
  • Location:Massachusetts

Posted 07 December 2004 - 03:47 PM

Thanks for the encouragement. I think I'll be dealing with this full-steam after the New Year.

#11 cyanide

cyanide

    HR 3

  • Active Members
  • PipPipPip
  • 93 posts
  • Location:Toronto, Canada

Posted 09 December 2004 - 03:03 AM

You might want to consider finding out who is linking to that page and ask them to point to your domain.... to avoid a pr-splitting scenario

#12 Minerva

Minerva

    HR 4

  • Active Members
  • PipPipPipPip
  • 152 posts
  • Location:Massachusetts

Posted 09 December 2004 - 08:15 AM

QUOTE
You might want to consider finding out who is linking to that page and ask them to point to your domain.... to avoid a pr-splitting scenario


Do you mean ask them to specifically ink to www.domain.com/index.php as opposed to just www.domain.com, as they do today?

Although the stats show tons of requests for the non-existent index.html of this site, it's not showing up in the 404 errors. Can I assume that's a good sign?

#13 chrishirst

chrishirst

    A not so moderate moderator.

  • Moderator
  • 5,880 posts
  • Location:Blackpool UK

Posted 09 December 2004 - 09:48 AM

It sounds like the server doing its job, When a request comes into the server without a trailing slash "/" eg domain.com instead of domain.com/ the server checks the default document list in order. index.php is probably the second one in the list.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users