Jump to content

Is this even possible? Deals with URL redirecting.


ginger44

Recommended Posts

This is what I'm trying to do...

I have a JSP page that I want to be accessed by being redirected.

Lets call this JSP page http://www.whatever.jsp?whatsup8

I was wondering, with PHP, is it possible to somehow just redirect the http://www.whatever.jsp? part and still be able to include the whatsup8 with the new redirected URL at the end.

Example:

The redirector page will be http://www.redirect.php

I will then place it as http://www.redirect.phpwhatsup8 or something like that and it will go to http://www.whatever.jsp?whatsup8 with redirect.php being the redirector.

I have many whatsup pages with different numbers, which is why I'm trying to do this. Any help will be appreciated. Thanks.
Link to comment
Share on other sites

You should save that as a PHP page named: "redirect.php". You would then type into your browser the following "http://www.domain.com/redirect?whatsup88".

Whatever "parameter" you enter after the question mark will be appended to the end of the jsp page that you are calling.
Link to comment
Share on other sites

[quote author=ginger44 link=topic=122500.msg505562#msg505562 date=1168899952]
Nope, that didnt work either. You're missing the .php after redirect in that code.
[/quote]
Ok, I'm trying to help you here. Your original question was not very clear and I did my best to interpret it. My code does "exactly" what I stated it does. You stated that you wanted to redirect to a jsp page, so whay do I need to put php in the redirect code.

In your original question you stated you wanted the following pages:  http://www.redirect.php &  http://www.whatever.jsp. Those aren't valid pages because there is no DOMAIN and php and jsp are not TLDs. So, I assumed you meant http://www.domain.com/redirect.php.

Anyway, if you saved the code above as a file named redirect.php and you placed it in the root of your website, then typing in http://www.yourdomain.com?123456 would redirect you to http://yourdomain.com/whatever.jsp?123456

is that not what you wanted? If not, please explain exactly what you want.
Link to comment
Share on other sites

[quote author=ginger44 link=topic=122500.msg506648#msg506648 date=1169008000]
Yes and that didn't work. Is it because the URL I'm trying to be redirected isn't from my domain?
[/quote]

If you are trying to redirect TO an external site, then that is possible (in fact I tested my code by having it redirect to Yahoo). If you want to have an external site redirected to your site, then, uh, how should I put this: NO!
Link to comment
Share on other sites

Well, I don't know what to tell you. I tested it and it works. As I said I built the solution based upon my interpretation of your requirements. I made assumptions where your requirements were obviously incorrect (e.g. the domain names). If you want to give a clear example of your exact needs I can help further.

For example:

[color=orange][i]I want that when the user types in http://www.mydomain.com/redirect.php?somecode that they are redirected to http://www.differentdomain.com/somepage.jsp?somecode[/i][/color]

That is what I had interpreted and coded for.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.