Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Index.php not loading in a subdirectory. Root is OK.

Status
Not open for further replies.

SimonDavis

Technical User
Mar 16, 2001
613
GB
I have a wesite that I have installed a shopping cart for, all of which seems to work OK other than going directly to the shop.

When I go to it's fine.

When I go to , the address in the browser changes to , and the page isn't found. (ie it drops the www)

If I go to , it loads OK.

I have temporarily solved it by copying index.php to index.htm. I'd prefer to find out what's happening though, as I'm sure it could cause other problems.

The webhost said they'd need to fix it by changing their dns records. That sounds kind of odd to me, but maybe that is the answer.

Any thoughts? Thanks.
 
I'm speculating, but I'm almost guessing that and mydomain.com are actually different hosts and your hoster is playing a little to fast and loose with your configuration?

ALTERNATIVELY there might be a mod_rewrite rule that you do/don't know about that is making changes to the URL request.

D.E.R. Management - IT Project Management Consulting
 
I remember reading something a year or so ago that there are those who are trying to do away with www. Anyway, I ain't too hip with changing the name of your index pages. I think a better way is to create a .htaccess file and add this line to it:

Code:
DirectoryIndex index.html index.htm index.php

[code]

The .htaccess file is a way for your hosting company to allow you to edit some of apache's configs.  Anything in this file only applies to your webspace.  If their servers are not configured for .htaccess, then ask them to add index.php to the DirectoryIndex directive.
 
OK, thanks for that. I'll try the htaccess fix. It'll just be a pain if I ave to do that on multiple directories. What I'm not sure about is why it works fine in the of the site, but not a subdirectory of that same url.

It doesn't work for the non anyway - doesn't work at all, for either root or a subdirectory.

Either way, I'm pretty sure it's nothing to do with dns.
 
Here's how you get a better answer...

"dig mydomain.com"
"dig
If these answers are not returning the same IP, then my suspicion that they are two different machines may be true.

If they return the same IP, then you need to pursue the .htaccess or httpd.conf adjustments needed to obtain the expected behavior for both hostname URLs.

I must say that the global definition in httpd.conf that specifies DirectoryIndex has always worked for me, irrespective of whether the host/virt-host is or just domain.tld... This presumes you are not over-riding these settings in a subsequent .htaccess file or are setting them outright in the .htaccess file.

OK?


D.E.R. Management - IT Project Management Consulting
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top