/    Sign up×
Community /Pin to ProfileBookmark

Hi

i would like to redirect if the user type: [url]www.website.com/news[/url]
to : [url]www.website.com?index.php?action=news[/url]

i supose this is not happening because when i type :[url]www.website.com/news[/url]
index.php file is not called

how can i redirect the url? ?

i am using :

if (location.host == “www.website.com/news”) {

document.location = “index.php?action=news”;

} else if (location.host == “www.website.com/talk”) {

document.location = “index.php?action=talk”;

}

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@konithomimoJul 18.2005 — Insert the following in the header tag of your www.website.com/news page:

<script type="text/javascript"><!--

if (window == top) top.location.href = "http://www.website.com?index.php?action=news";

//-->

</script>
Copy linkTweet thisAlerts:
@amrigoauthorJul 18.2005 — my problem is that i have just a index.php file which will receive the action url get parameter with the string wich will be read inside a switch to bring the correct file from a includes directory.
×

Success!

Help @amrigo 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.2,
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: @meenaratha,
tipped: article
amount: 1000 SATS,

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

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