Default page won't load

I am looking for some advice!

This, works fine locally but not on here, I have this code in my .htaccess:

RewriteEngine On
RewriteRule ^([a-zA-Z._-]+)$ system/application/controllers/$1 [L]

You can see here:
Fails: http://www.freelancerkit.com/beta/
Works: http://www.freelancerkit.com/beta/index.php

I had tried this, but it didn’t do me any good

DirectoryIndex index.php index.php

I have a blank index.php file (nothing is in it) in the root

Thanmks

JR,

RewriteEngine On
RewriteRule ^([a-zA-Z._-]+)$ system/application/controllers/$1 [L]

The only things I can see wrong with this are:

  1. The - really should be the first character in the range definition but, as the last character, it should not be causing any problem.

  2. Is the system/application/controllers directory in the website (in your DocumentRoot)?

If so, as I suspect, then there is likely a problem with your host’s configuration. To test it, change the [L] to [R=301,L] and see if the expected redirection has been made (and displayed).

Of course, you do need to confirm Apache 2.x as well as the fact that this mod_rewrite code is in your DocumentRoot.

Regards,

DK

Thanks for the response DKLynn.

So basically the main index.php page isn’t being called, or redirected it seems (from what i can gather lol)

With the 301 setting inside htaccess it still has this error http://www.freelancerkit.com/beta/

But if i type in index.php at the end of the URL above it will show the redirect correctly (it appends to the html root 404 error URL)
– This is okay, it will work normally and redirect if i turn the 301,L back to L

.htaccess with the rewrite code is in the /beta/ folder (thats all thats in .htaccess)

and my SERVER_SOFTWARE Apache/2.0.54

I’m not sure how much i can tweak Apache on a GRID Host but i can always email them

I haven’t solved it yet, but I’ll post here once I find out, Im going to have someone test on their server.

JR,

If beta/ is givnig a 404 but beta/index.php isn’t, then the DirectoryIndex for the beta directory does not include the index.php script. In that directory, look for a DirectoryIndex statement. If not there, go up to your DocumentRoot and enter (in your .htaccess):

DirectoryIndex index.php {whatever else that may be there separated by spaces, e.g., index.html, index.htm}

Regards,

DK

The weird thing is I tried that before and it actually loads the physical index.php file – yet doesn’t redirect it. I can run PHP in the blank index.php file (LOL).

So I popped this into the index.php and it’s behaving now:


<?php
ob_start();


if (basename($_SERVER['REQUEST_URI']) !== 'index.php')
{
    header('location: index.php');
}
/*

This file is intended to be empty.
Removing this will cause the mod_rewrite to not default to an index page.

*/
ob_end_flush();

?>

Thanks for the help :slight_smile: