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 |

Update: As of 4.2.12 there is a new option under Control Panel > Admin > Site Settings that allows you to automatically remove the /index/ from all urls in Sitellite. It is off by default but may be enabled by default in Sitellite 5.


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

Revised on March 7, 2007 11:00 AM by anonymous

Back in time (1 more) | Linked from: Miscellaneous