473,473 Members | 1,642 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Capturing the entire URL

Hello all,
Been playing around with capturing the entire URL. I dont have any problems
if it a file,
i.e. http://www.mydomain.com/somefile.php, I am running into problems with
this,
http://www.mydomain.com/test

This is what I use for "redirection" now (btw, it is IIS (Win2k) and PHP
4.3.2)
The test.mydomain.com is setup as a host header under IIS

$redirect = getenv("HTTP_HOST");

if ($redirect=="test.mydomain.com"){
header("Location:http://www.mydomain.com/modules.php?name=test");
}

The above code works fine. Redirects no problem.

However, I am trying to get this to do the same thing:
www.mydomain.com/test or www.mydomain.com/test/
and both would take you here:
http://www.mydomain.com/modules.php?name=test

I have tried every combination of the SERVER vars, but no luck.
I either generate a 404 or the test isn't part of the URL.

Any ideas ?
Jul 16 '05 #1
2 4069
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Whilst lounging around on Mon, 11 Aug 2003 11:18:29 -0800,
"fartsniff" <fa**@sniff.com> amazingly managed to produce the
following with their Etch-A-Sketch:
Hello all,
Been playing around with capturing the entire URL. I dont have any
problems if it a file,
i.e. http://www.mydomain.com/somefile.php, I am running into
problems with this,
http://www.mydomain.com/test

This is what I use for "redirection" now (btw, it is IIS (Win2k)
and PHP 4.3.2)
The test.mydomain.com is setup as a host header under IIS

$redirect = getenv("HTTP_HOST");

if ($redirect=="test.mydomain.com"){
header("Location:http://www.mydomain.com/modules.php?name=test");
}

The above code works fine. Redirects no problem.

However, I am trying to get this to do the same thing:
www.mydomain.com/test or www.mydomain.com/test/
and both would take you here:
http://www.mydomain.com/modules.php?name=test

I have tried every combination of the SERVER vars, but no luck.
I either generate a 404 or the test isn't part of the URL.

Any ideas ?

$_SERVER['REQUEST_URI'] should contain the stuff after the
domain.com/ part.

I'm sure you have good reasons.. but to me personally, this looks
like you're attempting to get PHP to do something that is best suited
to the server via mod_rewrite:
RewriteRule ^/(.*)/$ /modules.php?name=$1 [L]
or something similar.

Forgive me if I'm wrong =)

Regards,

Ian

-----BEGIN PGP SIGNATURE-----
Version: PGP 8.0

iQA/AwUBPzf6CGfqtj251CDhEQIjggCg/J2Ru64A9bSIGR8pORlXKzAiqMoAoN7r
FAKsAIVkowYNARM9gNR5M55c
=Yoop
-----END PGP SIGNATURE-----

--
Ian.H [Design & Development]
digiServ Network - Web solutions
www.digiserv.net | irc.digiserv.net | forum.digiserv.net
Programming, Web design, development & hosting.
Jul 16 '05 #2
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Whilst lounging around on Mon, 11 Aug 2003 12:31:48 -0800,
"fartsniff" <fa**@sniff.com> amazingly managed to produce the
following with their Etch-A-Sketch:
but isnt RewriteRule ^/(.*)/$ /modules.php?name=$1 [L]
only for apache ?

i am using iis on win2k.

[ looks around for some of that coffee ]
Indeed FS =[
The $_SERVER['REQUEST_URI'] should grab / display the info you
require for a PHP solution =)

Apologies for the misreading / confusion.

Regards,

Ian

-----BEGIN PGP SIGNATURE-----
Version: PGP 8.0

iQA/AwUBPzf9Qmfqtj251CDhEQJbpQCg+hnkB0ii3RCZ519uChtkQw duLTMAn3RW
jocp7IoLgUPTgH7WSNCkf/Pj
=y5Xw
-----END PGP SIGNATURE-----

--
Ian.H [Design & Development]
digiServ Network - Web solutions
www.digiserv.net | irc.digiserv.net | forum.digiserv.net
Programming, Web design, development & hosting.
Jul 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Jay Xx | last post by:
I have an IFrame in design mode. I've tried a bunch of things to capture key presses in that IFrame, but I can't seem to get it. I can capture key presses outside the IFrame fine. I have this...
33
by: Joerg Schuster | last post by:
Hello, Python regular expressions must not have more than 100 capturing groups. The source code responsible for this reads as follows: # XXX: <fl> get rid of this limitation! if...
0
by: veena | last post by:
hello, i have got a problem of how to capture two keys when pressed together i.e in my task i require certain action to be performed when the ctrl and 'A' keys are pressed together i.e i need to...
0
by: joseph.inglis | last post by:
Heres an interesting one and i guess its idea that are needed as opposed to a direct solution (although one would be welcomed of course). I want to render a webpage as an image. At the moment...
1
by: kevin | last post by:
I am trying to strip the outermost html tag by capturing this tag with regex and then using the string replace function to replace it with an empty string. while stepping through the code, RegEx...
14
by: Brent Burkart | last post by:
I am trying to capture the Windows Authenticated username, but I want to be able to capture the login name that exists in IIS, not Windows. In order to enter my company's intranet through the...
0
by: Buglish | last post by:
Hi, Task : -Capture a HTML table with use of regular expression from a text string buffer(entire document). –Pass it to another function to create a multi dimension array out of it. - Pass it...
2
by: raghu77 | last post by:
I want to capture the full content of a form even if the form is too large. I want entire form content with in one image. that will be saved in the physical drive. Kindly help plz...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.