Help needed with URL/PHP issues on Apache/MySQL server
September 22, 2008 4:07 AM   Subscribe

I am having trouble with URLs 404ing on an Apache/MySQL server for a website using Wordpress, with some custom add-ons to use Wordpress as a CMS.

I have a website which I have built for a client using Wordpress, on an Apache server with MySQL as the database. Their blog is available on and works fine.

I've created several index.php files on the main site, and in subfolders, using the Wordpress header and some custom PHP code to pull their page content from the WP database (I'm using Wordpress pages as data for a CMS). The URLs for the pages are in the format and

Unfortunately, I am having several errors a day with problems and 404 where the URLs are not resolving properly (i.e. you type in and it 404s). I can get round it by typing the filename index.php at the end, but I wanted to keep the URLs "clean".

The problem mainly occurs in IE7 (no surprise), but has occurred to several users - my clients and clients of theirs, and they are understandably miffed.

Can someone help point me towards any possible solutions?
posted by Scramblejam to Computers & Internet (7 answers total)
Two possibilities:

1. An issue with the default document setting in Apache, although it seems unlikely.

2. There could be an issue with a .htaccess file somewhere on the site (probably the webroot directory) that's rewriting URLs in a way that causes a problem.
posted by le morte de bea arthur at 4:33 AM on September 22, 2008

I can get round it by typing the filename index.php at the end, but I wanted to keep the URLs "clean".

From the little I know of the web server world, I would second that this sounds like a .htaccess problem. Wordpress rewrites their URLs using it, perhaps the main site is trying to do that as well and you're running into a conflict.
posted by genial at 5:49 AM on September 22, 2008

Usually problems like this go away, when I ask Wordpress to rewrite its permalink structure twice. So I change it to whatever option differs greatly from how it is now. And after that, I turn the permalink back to how I wanted it in the first place.
posted by ijsbrand at 6:17 AM on September 22, 2008

Response by poster: Do you think I need the Wordpress-configured .htaccess in the /blog folder or the webroot folder?
posted by Scramblejam at 7:56 AM on September 22, 2008

Check the apache logs and see *exactly* what people are requesting when they get the 404s.

My guess would be that it's either an issue of versus

Or maybe they're requresting (which is not the same thing on a UNIX-based server)
posted by meta_eli at 9:16 AM on September 22, 2008

I'm pretty sure you need .htaccess in the webroot folder. The other thing is, Wordpress loves to overwrite your custom rewriterules whenever you make changes to your permalink structure through their admin page, so make sure you keep a backup!
posted by Glendale at 10:01 AM on September 22, 2008

Response by poster: Thanks guys, this is really starting to become much clearer...

There were two .htaccess files, with different settings, one in webroot with my custom settings, and another in the /blog wordpress folder. I guess I only want one!

in addition, the raw root files tell me the users are requesting URLs with a trailing slash - For example: as opposed to

I can easily change the URLs in the PHP to remove the trailing slashes, if this will make a difference?
posted by Scramblejam at 2:21 AM on September 23, 2008

« Older Why did she lie to me?   |   wow me with the wonders of web2.0 Newer »
This thread is closed to new comments.