/    Sign up×
Community /Pin to ProfileBookmark

Directory Redirection

Hi,

How is it possible to create a script which will redirect the visitor in this fashion:

[url]http://www.domain.com/direct/msn[/url] ==> [url]http://www.domain.com/test.php?p=msn[/url]

[url]http://www.domain.com/direct/google[/url] ==> [url]http://www.domain.com/test.php?p=google[/url]

[url]http://www.domain.com/direct/yahoo[/url] ==> [url]http://www.domain.com/test.php?p=yahoo[/url]

and so on?

In other words,

[url]http://www.domain.com/direct/variable[/url] ==> [url]http://www.domain.com/test.php?p=variable[/url]

Can someone help?

Thanks.

Daniel

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@UncommonerOct 16.2004 — it has to do with the get function.

wright this into test.php and run it for a example
[code=php]

<a href="test.php?p=msn">MSN</a>
<a href="test.php?p=google">Google</a><br>

<?php
if ($_GET['p']) {
if ($p == "msn"){
echo "somthing to do with msn";
}
if ($p == "google"){
echo "something to do with google";
}
}
?>
[/code]



if thats what you mean that is.....
Copy linkTweet thisAlerts:
@Bootsman123Oct 16.2004 — You could create an .htaccess and place this inside it:
[code=php]
RewriteEngine On
RewriteRule ^direct/(.*)/?$ test.php?p=$1
[/code]
×

Success!

Help @danlohye spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...