Results 1 to 6 of 6
-
12-05-2003, 01:57 AM #1Newbie
- Join Date
- Nov 2003
- Posts
- 15
How to add a global "redirect" to site?
I have a site and would like to setup a automatic custom link type of thing. What I am refering to is what I've seen on numerous sites such as
http://www.mysite.com/blah/redirect.php?
So if someone entered http://www.store.com it would turn it into http://www.mysite.com/blah/redirect..../www.store.com on my site, with the final result being a customized affiliate link?
-
12-05-2003, 02:44 AM #2Web Hosting Master
- Join Date
- Dec 2002
- Location
- The Shadows
- Posts
- 2,925
Should be fairly easy to do. If you feel like monkeying yourself, check out apache.org's info on mod_rewrite.
Otherwise, I will let someone else post, since I need sleep... I have two exams tomorrowDan Sheppard ~ Freelance whatever
-
12-05-2003, 08:43 AM #3Web Hosting Master
- Join Date
- Jul 2003
- Location
- Kuwait
- Posts
- 5,104
Try this
Code:<IfModule mod_rewrite.c> RewriteEngine on RewriteRule (*.?) http://www.foo.com/redirect?site=$1 [L, QSA] </IfModule>
-
12-08-2003, 12:51 AM #4Newbie
- Join Date
- Nov 2003
- Posts
- 15
While I appreciate your responses, fyrestrtr. I dont understand what your saying. I know how and can add it to the right spot but after that im still stumped.
-
12-08-2003, 07:21 AM #5Web Hosting Master
- Join Date
- Jul 2003
- Location
- Kuwait
- Posts
- 5,104
Well firstly, I goofed on it.
Its supposed to be ^(.*?)$ not (*.?)
Anyhow, here is what it does.
It takes any request, and passes it as an argument to your redirect script.
So, if someone enters (in their browser)
http://www.site.com/
mod_rewrite will actually send it to
http://www.foo.com/redirect?site=http://www.site.com/
You have to write the redirect script (foo.com/redirect), of course.
Hopefully this makes it a bit clear. You may also want to look over the URL Rewriting Guide over at apache.org
-
12-08-2003, 04:12 PM #6Newbie
- Join Date
- Nov 2003
- Posts
- 15
Much clearer
Thanks a bunch!