Solved

uri string

Posted on 2012-03-25
3
376 Views
Last Modified: 2012-06-27
hello -

im trying to test if uri string = url {

do this ....

}

here is the code
<?php if ($_SERVER['REQUEST_URI'] == 'http://localhost/wasabiii.dev/index.php') { ?>
<a href="lang/de/index.php" title="German"  />Deutsch</a>

Open in new window


else do this
<?php } else {?>
<a href="../lang/de/index.php" title="German"  />Deutsch</a>
<?php }?>

Open in new window


the purpose of this logic is so that if its in the main domain it will be redirected to the correct path. same as if in a sub domain hence the ../

what it does not do is capture the url and perform the requested process.
0
Comment
Question by:only1wizard
  • 2
3 Comments
 
LVL 7

Accepted Solution

by:
designatedinitializer earned 500 total points
ID: 37763130
Notice that $_SERVER['REQUEST_URI'] gives you the URI that was given to the server in order to access that particular page. In this case, it can be several things, like:
'http://localhost/wasabiii.dev/index.php'
'/index.php'
'../index.php'

You can determine what's going on if you place this before your 'if' clause:
print_r($_SERVER);

Open in new window

This will show you all the information you need to solve your problem.
0
 

Author Comment

by:only1wizard
ID: 37763135
thanks will try that
0
 

Author Closing Comment

by:only1wizard
ID: 37763145
thanks for your help!
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question