PHP Classes
elePHPant
Icontem

File: DOC

Recommend this page to a friend!
  Classes of Benjamin Falk  >  Relink  >  DOC  >  Download  
File: DOC
Role: Documentation
Content type: text/plain
Description: A short documentation
Class: Relink
Rewrite URLs based on mod_rewrite configuration
Author: By
Last change: Fixed a real big mistake
It is called $c_relink->replaceLink instead of $c_relink
Date: 11 years ago
Size: 824 bytes
 

 

Contents

Class file image Download
Download example.php and htaccess-example for testing the script.

The easiest way is just to include the class with require_once or include_once.
Here a little example:
----- example-file.php -----
<?php
	require_once 'class.relink.php';
	$c_relink = new RELINK(); //Reads the .htaccess from the current workdirectory
	echo $c_relink->replaceLink('?page=index');
?>
----- end example-file.php -----

And in your .htaccess-file is the following:
----- .htaccess -----
## to add a different text before every link, use the following (optional)
#set link start http://www.example.org/


## turning on the rewrite-engine
RewriteEngine on

## allow relink-class to read the upcoming rules
#set link auto on
RewriteRule (.+?)\.html ?page=$1
----- end .htaccess -----

See the example-files.

Greetings