Apache rewrite map

Reply

Join Date: Apr 2005
Posts: 4
Reputation: davespink is an unknown quantity at this point 
Solved Threads: 0
davespink davespink is offline Offline
Newbie Poster

Apache rewrite map

 
0
  #1
Apr 18th, 2005
Hi,

I want to take a shot at writing an Apache RewriteMap in PHP.
The example they give is in perl, which I don't know.

The perl example is here
http://httpd.apache.org/docs/mod/mod...#RewriteEngine

I'm not going to do anything to ambitious, but they do give a warning that
if you get it wrong you hang the server, so I was hoping someone can point me at a simple example of such a module in PHP, or give me a few pointers as to potential pitfalls. Or if anyone knows perl point me to the PHP equivalence.

Otherwise I'm going to have to learn a bit of perl ( which I really don't want to do ).

thanks

dave
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 355
Reputation: DanceInstructor is an unknown quantity at this point 
Solved Threads: 14
DanceInstructor's Avatar
DanceInstructor DanceInstructor is offline Offline
Posting Whiz

Re: Apache rewrite map

 
0
  #2
Apr 18th, 2005
There is a pretty good tutorial here. There is also a tutorial here on Daniweb at this link that deals with rewriting for vbulletin. I haven't read the tutorial here on Daniweb, but I'm sure there are lots of questions and answers that may be helpful as it is a huge thread. I also assume you have had a look at the Apache URL Rewriting Guide, I found it very hard to follow :o Understand that you really aren't doing anything in PHP, you will be creating commands that the apache server interprets and executes itself.

Good luck.
Clear Mind Hosting and Web Design

If I've helped you please consider adding to my reputation.
Reply With Quote Quick reply to this message  
Join Date: Apr 2005
Posts: 4
Reputation: davespink is an unknown quantity at this point 
Solved Threads: 0
davespink davespink is offline Offline
Newbie Poster

Re: Apache rewrite map

 
0
  #3
Apr 18th, 2005
Thanks,

Actually I'm pretty close to cracking this one.

Not sure what you mean about "not doing anything in PHP" tho. I've written the Rewrite rules in PHP and made it into a shell script which Apache will read when it does a RewriteRule in .htaccess

I think it's near to working, only think I can't quite figure is the correct syntax for the rewrite rule.

Currently I have

RewriteRule \.(wmv)$ $(nohotlink1)

where nohotlink is the name of my map.

I want to feed all files of type .wmv into my RewriteMap ( which is the PHP bit ). I'll go look at the tutorials now.

Thanks for the tip!
Reply With Quote Quick reply to this message  
Join Date: Apr 2005
Posts: 4
Reputation: davespink is an unknown quantity at this point 
Solved Threads: 0
davespink davespink is offline Offline
Newbie Poster

Re: Apache rewrite map

 
0
  #4
Apr 18th, 2005
OK solved!

It was so late at night I didn't notice the ( and ) were { and }

RewriteEngine On
RewriteRule \.(wmv)$ ${nohotlink1}

does the trick.

thanks all

I've been developing PHP for a few months now, and I like it. It's pretty easy and I've never really got stuck on anything, but it's nice to find a board to post to. I'll try to come back and maybe answer a few questions as well as ask em.

have a nice day!
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC