What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » Mod_Rewrite help

Mod_Rewrite help
Author: Message:
Dempsey
Scripting Contest Winner
*****

Avatar
http://AdamDempsey.net

Posts: 2395
Reputation: 53
38 / Male / Flag
Joined: Jul 2003
O.P. Mod_Rewrite help
Wondering if anyone can help me with Mod_Rewrite?

I have a domain called Whois setup to point at my main domain, and have this in my .htaccess file:
code:
RewriteCond %{HTTP_HOST} ^(www\.)?whois.mydomain.com
RewriteRule ^$ /whois.php?d=$1 [L]

Now I'm trying to make it so whatever is apended after the domain gets passed as a variable to the script, eg
whois.mydomain.com/google.com would call whois.php?d=google.com

I got a regex to match a domain (/([a-z0-9.-]+\.[a-z]{2,4})/i) but can't get it to work, and am a bit stuck now so wondered if anyone can help.

Any help will be greatly appreciated :-)

SoundPacks   -   Scripts   -   Skins

that's not a bug, thats an unexpected feature
10-02-2008 09:11 PM
Profile E-Mail PM Web Find Quote Report
Mike
Elite Member
*****

Avatar
Meet the Spam Family!

Posts: 2795
Reputation: 48
32 / Male / Flag
Joined: Mar 2003
Status: Online
RE: Mod_Rewrite help
You should be able to modify step 3 from here to achieve what you want :)

This post was edited on 10-03-2008 at 04:03 AM by Mike.
YouTube closed-captions ripper (also allows you to download videos!)
10-03-2008 04:01 AM
Profile E-Mail PM Web Find Quote Report
WDZ
Former Admin
*****

Avatar

Posts: 7106
Reputation: 107
– / Male / Flag
Joined: Mar 2002
RE: Mod_Rewrite help
Tested and working with this .htaccess file:
code:
Options +FollowSymLinks
RewriteEngine On

RewriteCond %{HTTP_HOST} ^(www\.)?whois\.mydomain\.com
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([a-z0-9.-]+\.[a-z]{2,4})$ /whois.php?d=$1 [L,NC]
The second RewriteCond prevents an infinite loop (because the domain regex matches "whois.php"), and the [NC] flag is used instead of the 'i' modifier.
10-03-2008 06:02 AM
Profile PM Web Find Quote Report
Dempsey
Scripting Contest Winner
*****

Avatar
http://AdamDempsey.net

Posts: 2395
Reputation: 53
38 / Male / Flag
Joined: Jul 2003
O.P. RE: Mod_Rewrite help
Thanks WDZ works perfect :D
SoundPacks   -   Scripts   -   Skins

that's not a bug, thats an unexpected feature
10-03-2008 08:13 AM
Profile E-Mail PM Web Find Quote Report
Forcegames
New Member
*

Avatar
Yueko - Darani-Forces

Posts: 1
– / Male / –
Joined: Oct 2008
RE: Mod_Rewrite help
wow o.o I'm wondering
i've had a problem with mod_rewrite too, some time ago. i posted it in a special "Mod rewrite Forum" but no one cared xD I guess my chances here are a bit better here xD unfortunately my english is too bad to formulate my problem in english rather than german :D

Damn it ^^
10-05-2008 10:02 PM
Profile E-Mail PM Web Find Quote Report
Menthix
forum admin
*******

Avatar

Posts: 5537
Reputation: 102
40 / Male / Flag
Joined: Mar 2002
RE: Mod_Rewrite help
Your English doesn't seem *that* bad. Why not give it a try? Post the same in both German and English if you like, there are some German speakers here that could help you out.
Finish the problem
Menthix.net | Contact Me
10-05-2008 10:19 PM
Profile E-Mail PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On