Members

Note: You can use your Sitellite.org account here and vice versa.

Username

Password

Remember Login

Forgot your password?

Not a member? Click here to register

Removing Index From Url

Home Page | All Pages | Recently Revised | Authors | Feeds |

Note: This requires Apache's mod_rewrite extension.

1. Add the following mod_rewrite rule to your .htaccess file:

RewriteEngine On
RewriteRule ^([a-zA-Z0-9_-]+)$ index?sticky=$1 [QSA,L]

2. Open the file saf/lib/CGI/CGI.php and change:

if (strstr ($_SERVER['REQUEST_URI'], '?')) {
    $uri = urldecode (substr ($_SERVER['REQUEST_URI'], 0, strpos ($_SERVER['REQUEST_URI'], '?')));
} else {
    $uri = urldecode ($_SERVER['REQUEST_URI']);
}

to:

if (strstr ($_SERVER['REQUEST_URI'], '?')) {
    $uri = urldecode (substr ($_SERVER['REQUEST_URI'], 0, strpos ($_SERVER['REQUEST_URI'], '?')));
} else {
    $_SERVER['REQUEST_URI'] = '/index/' . $_GET['sticky'];
    $uri = urldecode ($_SERVER['REQUEST_URI']);
}

You should now be able to access any page without the /index/, for example:

http://www.example.com/contact
http://www.example.com/products

Revision from August 1, 2007 1:15 PM by anonymous

Forward in time (1 more) | See current | See changes | Linked from: Miscellaneous