PHP Linking & Mod_Rewrite Tutorials

Status
Not open for further replies.

coolv1994

Member
Messages
508
Reaction score
0
Points
16
Here is two code to hide the acteual pages from your users:

1.PHP Linking
Example: index.php?id=1 instead of page1.php
Here's the code:
PHP:
<?php 
if(!$_GET['id']) include('home.php');  
if($_GET['id'] == '1') include('page1.php'); 
if($_GET['id'] == '2') include('page2.php'); 
if($_GET['id'] == '3') include('page3.php'); 
else include('nopath.php'); 
?>
*Remember to move all existing content from index.php to home.php and put this code where you want the content to switch.

2.Mod_Rewrite
Example:index.php changes to home
Here's the code:
Code:
RewriteEngine On 
RewriteRule ^(home.*)$ index.php
*Make sure that this is in your .htaccess file and that it come's after the "# -FrontPage-" but put the code on line 2 or 3.
_________________________________
If you are having trobel PM me for help.
 
Status
Not open for further replies.
Top