Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Directory Redirect Help
Old 08-12-2005, 05:00 PM Directory Redirect Help
Novice Talker

Posts: 9
Trades: 0
I am not sure if this is the right place top but this here is my problem.

I want to make it so http://blog.domain.com/AfterShock will go to http://blog.domain.com/blog.php?name=AfterShock

Also like this

http://blog.domain.com/Someone1 >>> http://blog.domain.com/blog.php?name=Someone1
http://blog.domain.com/Someone2 >>> http://blog.domain.com/blog.php?name=Someone2

This is for my php users system. I have been told by many people to use .htaccess files to do it but I have no idea how to do it.
AfterShock is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-12-2005, 10:55 PM
Experienced Talker

Posts: 31
Location: Simi Valley, CA
Trades: 0
You could set the catch22 page on your server to an intermediate file (maybe referer-redirect.php) and then use $_SERVER['HTTP_REFERER'] to find the URL of the refering page. Then you can use the following to redirect to the page URL that you want:
PHP Code:
// save the referer path
$path $_SERVER['HTTP_REFERER'];
$name= (manipulate path to get what you want)

// this redirects the page
header("Location: http://www.yoursite.com/blog.php?name=$name"); 
However, I should caution you that according to the PHP manual, 'HTTP_REFERER' "cannot be trusted." Try it out and see if it works!
__________________
Andrew

Please login or register to view this content. Registration is FREE

Last edited by ademaskoo; 08-12-2005 at 11:09 PM.. Reason: typo
ademaskoo is offline
Reply With Quote
View Public Profile Visit ademaskoo's homepage!
 
Old 08-13-2005, 03:21 AM
Novice Talker

Posts: 9
Trades: 0
i've asked one of my friend who is using this kind of methond
he said you have to set in the Apache setting
create an alias for it and everything done.

i'm don't have example with me now.
i try to get one for you if i can

good luck
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
sogua is offline
Reply With Quote
View Public Profile
 
Old 08-15-2005, 12:42 AM
Novice Talker

Posts: 9
Trades: 0
Quote:
Originally Posted by ademaskoo
You could set the catch22 page on your server to an intermediate file (maybe referer-redirect.php) and then use $_SERVER['HTTP_REFERER'] to find the URL of the refering page. Then you can use the following to redirect to the page URL that you want:
PHP Code:
// save the referer path
$path $_SERVER['HTTP_REFERER'];
$name= (manipulate path to get what you want)

// this redirects the page
header("Location: http://www.yoursite.com/blog.php?name=$name"); 
However, I should caution you that according to the PHP manual, 'HTTP_REFERER' "cannot be trusted." Try it out and see if it works!
Where would i put this code, in index.php? Also I am not sure what I should put inside $name. Because I need this non-existing directory to redirect to a file like blog.php?name=$username and $username is the directory that doesnt exist.
AfterShock is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Directory Redirect Help
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.13300 seconds with 12 queries