Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

uri string

Posted on 2012-03-25
3
Medium Priority
?
391 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 2000 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article was originally published on Monitis Blog, you can check it here . Today it’s fairly well known that high-performing websites and applications bring in more visitors, higher SEO, and ultimately more sales. By the same token, downtime…
It’s a season to be thankful, and we’re thankful for users like you who engage on site, solve technology problems, and network with others in the industry. What tech are we most thankful for? Keep reading.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
Suggested Courses

926 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