944,054 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 8982
  • PHP RSS
Apr 18th, 2005
0

Apache rewrite map

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
davespink is offline Offline
4 posts
since Apr 2005
Apr 18th, 2005
0

Re: Apache rewrite map

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.
Reputation Points: 17
Solved Threads: 14
Posting Whiz
DanceInstructor is offline Offline
355 posts
since Feb 2005
Apr 18th, 2005
0

Re: Apache rewrite map

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!
Reputation Points: 10
Solved Threads: 0
Newbie Poster
davespink is offline Offline
4 posts
since Apr 2005
Apr 18th, 2005
0

Re: Apache rewrite map

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!
Reputation Points: 10
Solved Threads: 0
Newbie Poster
davespink is offline Offline
4 posts
since Apr 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Contribute code
Next Thread in PHP Forum Timeline: need to update each records after record deleted





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC