Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

capture the typed URL on custom error

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

capture the typed URL on custom error

Postby ChrisSkidmore » Thu Sep 05, 2002 8:16 am

My end goal is to make

http://www.domainname.de/anyname
(actual page will not exist as such)

redirect to a page that will take the URL, and split out the "anyname"
into a variable.

My idea was to create a custom error page using .htaccess.

It works fine when accessed from a link but of course if the URL has been
typed in there is no "referer"

Be grateful for any ideas or even a better way to do the whole thing!!!

Chris
ChrisSkidmore
New php-forum User
New php-forum User
 
Posts: 19
Joined: Sun Aug 18, 2002 4:02 am
Location: Germany

Postby Jay » Thu Sep 05, 2002 2:14 pm

Off the top of my head it's $_SERVER['REQUEST_URI']! You could always try the print_r($_SERVER) command to print out all the variables, and pick it out, but I'm pretty sure it's the $_SERVER['REQUEST_URI'] one!
Jay
 

Postby ChrisSkidmore » Fri Sep 06, 2002 12:49 pm

Hi,
Many thanks again for the promt answer. Your print_r($_SERVER) worked beautifully unfortunately though it told me I was barking up the wrong tree.
$_SERVER['REQUEST_URI']! didn't give the URL that was typed. Although I think that one does give the refering URL if it's from a link.

From what I've read the only route is to use a CGI program - another skill to master!!!

If you don't mind I'm sure I'll be back!!!


Chris
ChrisSkidmore
New php-forum User
New php-forum User
 
Posts: 19
Joined: Sun Aug 18, 2002 4:02 am
Location: Germany

Postby Jay » Sat Sep 07, 2002 1:35 am

There is one option, I know because I use it - I'm just too lazy to go out and find out which one it is though!
Jay
 

Postby ChrisSkidmore » Sat Oct 05, 2002 4:11 am

Thought I'd let you know I eventally worked out the problem why I could get $_SERVER['REQUEST_URI'] to work.
I'm running IIS. When I upload to my apache server it worked!!!

Many thanks -(and sorry for doubting!!)
ChrisSkidmore
New php-forum User
New php-forum User
 
Posts: 19
Joined: Sun Aug 18, 2002 4:02 am
Location: Germany

Postby Jay » Sat Oct 05, 2002 10:04 am

It took you a month to figure that out :lol:

Only kidding, glad it worked!
Jay
 

Postby ChrisSkidmore » Sat Oct 05, 2002 11:35 am

I had been doing other things in the mean time - you know changing nappies and things!!!
ChrisSkidmore
New php-forum User
New php-forum User
 
Posts: 19
Joined: Sun Aug 18, 2002 4:02 am
Location: Germany

Postby Jay » Sun Oct 06, 2002 9:47 am

OK, I forgive you ;)
Jay
 


Return to PHP coding => General

Who is online

Users browsing this forum: Google Feedfetcher and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron