i am using linux shared server ,so i dont have access of php.ini file
You don't need access to the php.ini file. You either need access to the httpd.conf file or to use PHP (eg. edit view_profile.php or create a new .php file).
You could have a mod_rewrite such as
- Code: Select all
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^view_profile/([0-9]+)/[^/]+/[^/]+/?$ /view_profile.php?bni_id=$1 [QSA,L]
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{QUERY_STRING} ^(.*&)?bni_id=[0-9]+(&.*)?$ [NC]
RewriteRule ^view_profile\.php$ /view_profile_redirect.php [QSA,L]
and then in view_profile_redirect.php you would have something like
- Code: Select all
<?php
if(isset($_GET['bni_id']) && !empty($_GET['bni_id']))
{
$user_id = intval($_GET['bni_id']);
$redirect_url = 'http://' . getenv('HTTP_HOST') . '/view_profile/' . $user_id . '/';
// Search your database using the user_id variable to get the users information.
$user_info_1 = ...; // eg. florist-in-barnet
$user_info_2 = ...; // eg. debbie-killoran
// Do a 301 redirect.
header('Location: ' . $redirect_url . $user_info_1 . '/' . $user_info_2 . '/', true, 301);
exit();
}
else
{
header('Location: http://' . getenv('HTTP_HOST') . '/', true, 301);
}
There are bits missing in the above. You must make it search your (i presume) database to find the relevant information.