theniteowl
Programmer
I need to create a PHP script to parse out the URL/Querystring.
I will use the info to redirect the request through my own template file but there are a few things I need to consider.
The URL may be a full URL like or it may be a relative path like myfile.htm or /subfolder/myfile.htm, so I have to look for both possibilities.
The URL may contain parameters like myfile.htm?someval=12&anotherval=Test
Or it may be like myfile.htm#something.
I want to preserve these so they can be passed on to the content page that will be loaded.
Are there other things on the URL I should be looking for as well? I do not want to block capabilities the pages would have if their links were loading the pages directly rather than going through my script.
Can a URL contain both ?myval=something and #something and if so is there a requirment for the order in which they appear?
I am using header("Location:......") to redirect the page with the newly modified URL. If the original link is to a page outside of the local web site I would like that page to open in a new window rather than altering the current browsers path. Can this be done from PHP or do I need client-side code for it?
Any thoughts on other things I may need to look for when processing the URL for the redirection?
I have been looking around at bits of code for parsing and none so far seem to accomodate whole and relative paths or cover all of the possible parameters I may have to look for so I may have to go from scratch. Any suggestions on approach or which methods would be particularly useful would be appreciated as I am unfamiliar with most PHP methods and functions.
Thanks.
It's hard to think outside the box when I'm trapped in a cubicle.
I will use the info to redirect the request through my own template file but there are a few things I need to consider.
The URL may be a full URL like or it may be a relative path like myfile.htm or /subfolder/myfile.htm, so I have to look for both possibilities.
The URL may contain parameters like myfile.htm?someval=12&anotherval=Test
Or it may be like myfile.htm#something.
I want to preserve these so they can be passed on to the content page that will be loaded.
Are there other things on the URL I should be looking for as well? I do not want to block capabilities the pages would have if their links were loading the pages directly rather than going through my script.
Can a URL contain both ?myval=something and #something and if so is there a requirment for the order in which they appear?
I am using header("Location:......") to redirect the page with the newly modified URL. If the original link is to a page outside of the local web site I would like that page to open in a new window rather than altering the current browsers path. Can this be done from PHP or do I need client-side code for it?
Any thoughts on other things I may need to look for when processing the URL for the redirection?
I have been looking around at bits of code for parsing and none so far seem to accomodate whole and relative paths or cover all of the possible parameters I may have to look for so I may have to go from scratch. Any suggestions on approach or which methods would be particularly useful would be appreciated as I am unfamiliar with most PHP methods and functions.
Thanks.
It's hard to think outside the box when I'm trapped in a cubicle.