How to process http://MYURL/tag/foo
How to process http://MYURL/tag/foo
am 30.10.2007 14:33:10 von para.keet6
Hi all,
I want to set up my Apache server so that I can have
a script process URLs like http://MYURL/tag/foo,
such that a script named tag will receive the word
"foo" as a parameter.
Anybody know how this can be done?
Thanks.
Re: How to process http://MYURL/tag/foo
am 30.10.2007 14:50:33 von clbr
On Oct 30, 1:33 pm, para.ke...@yahoo.com wrote:
> Hi all,
>
> I want to set up my Apache server so that I can have
> a script process URLs likehttp://MYURL/tag/foo,
> such that a script named tag will receive the word
> "foo" as a parameter.
>
> Anybody know how this can be done?
>
> Thanks.
RewriteRule ^tag/(.*)$ /tag/script.php?foo=$1 [L]
Re: How to process http://MYURL/tag/foo
am 30.10.2007 16:06:00 von para.keet6
> RewriteRule ^tag/(.*)$ /tag/script.php?foo=$1 [L]
I just tried that and it doesn't work.
I enabled mod_rewrite, added the line above, and
even added the tag directory FWIW. Alas
it gives error 404.
Re: How to process http://MYURL/tag/foo
am 30.10.2007 17:22:24 von Jim Hayter
para.keet6@yahoo.com wrote:
>> RewriteRule ^tag/(.*)$ /tag/script.php?foo=$1 [L]
>
> I just tried that and it doesn't work.
> I enabled mod_rewrite, added the line above, and
> even added the tag directory FWIW. Alas
> it gives error 404.
>
When debugging rewrite rule problems, also consider enabling the rewrite
log:
RewriteLogLevel 5
will give you some data to help determine your problem.
Jim
Re: How to process http://MYURL/tag/foo
am 30.10.2007 17:52:14 von para.keet6
> RewriteLogLevel 5
> will give you some data to help determine your problem.
Oddly, there's nothing in the log. I did restart Apache,
so this is strange.
Re: How to process http://MYURL/tag/foo
am 30.10.2007 18:03:05 von clbr
On Oct 30, 3:06 pm, para.ke...@yahoo.com wrote:
> > RewriteRule ^tag/(.*)$ /tag/script.php?foo=$1 [L]
>
> I just tried that and it doesn't work.
> I enabled mod_rewrite, added the line above, and
> even added the tag directory FWIW. Alas
> it gives error 404.
Did you change script.php to the proper name of php script on your
server?
Re: How to process http://MYURL/tag/foo
am 30.10.2007 18:42:34 von para.keet6
> Did you change script.php to the proper name of php script on your
> server?
Yes, and I chmod'd it to 777, as well as the tag directory.
Re: How to process http://MYURL/tag/foo
am 30.10.2007 19:27:33 von Jim Hayter
para.keet6@yahoo.com wrote:
>> RewriteLogLevel 5
>> will give you some data to help determine your problem.
>
> Oddly, there's nothing in the log. I did restart Apache,
> so this is strange.
>
>
Did you add the 'RewriteLog ' directive to tell Apache where to
write the log?
Jim
Re: How to process http://MYURL/tag/foo
am 30.10.2007 19:51:42 von clbr
On Oct 30, 5:42 pm, para.ke...@yahoo.com wrote:
> > Did you change script.php to the proper name of php script on your
> > server?
>
> Yes, and I chmod'd it to 777, as well as the tag directory.
1. Can you reach your script direclty?: http://YOURSERVER/tag/script.php?foo=parameter
2. If so can you dump your .htaccess here?
3. you shouldn't change mode to 777. 7=4(read)+2(write)+1(executable)
which is not a good idea. 4 is enough.
Re: How to process http://MYURL/tag/foo
am 30.10.2007 19:59:20 von para.keet6
> Did you add the 'RewriteLog ' directive to tell Apache where to
> write the log?
Yes, it has 0 bytes.
Re: How to process http://MYURL/tag/foo
am 30.10.2007 20:08:41 von para.keet6
> 1. Can you reach your script direclty?:http://YOURSERVER/tag/script.php?foo=parameter
yes
> 2. If so can you dump your .htaccess here?
There is only one, at c:\
It only has AuthName, AuthType, and ..
Re: How to process http://MYURL/tag/foo
am 30.10.2007 20:13:36 von clbr
On Oct 30, 7:08 pm, para.ke...@yahoo.com wrote:
> > 1. Can you reach your script direclty?:http://YOURSERVER/tag/script.php?foo=parameter
>
> yes
>
> > 2. If so can you dump your .htaccess here?
>
> There is only one, at c:\
> It only has AuthName, AuthType, and ..
Can you dump your .htaccess as it is?(remove your 'private data')
Re: How to process http://MYURL/tag/foo
am 30.10.2007 20:17:28 von para.keet6
> Can you dump your .htaccess as it is?(remove your 'private data')
You see, it's very simple:
AuthName "..."
AuthType Basic
order allow,deny
deny from ....
allow from all
Re: How to process http://MYURL/tag/foo
am 30.10.2007 20:21:49 von clbr
On Oct 30, 7:17 pm, para.ke...@yahoo.com wrote:
> > Can you dump your .htaccess as it is?(remove your 'private data')
>
> You see, it's very simple:
>
> AuthName "..."
> AuthType Basic
>
>
> order allow,deny
> deny from ....
> allow from all
>
Where is RewriteRule in this file??
Re: How to process http://MYURL/tag/foo
am 30.10.2007 20:30:04 von para.keet6
> Where is RewriteRule in this file??
You mean it doesn't go in httpd.conf?
Re: How to process http://MYURL/tag/foo
am 30.10.2007 20:37:49 von para.keet6
>
> Where is RewriteRule in this file??
I moved all the RewriteRule's from httpd.conf to .htaccess
and restarted Apache, but it still doesn't work.
Re: How to process http://MYURL/tag/foo
am 30.10.2007 20:47:42 von clbr
On Oct 30, 7:37 pm, para.ke...@yahoo.com wrote:
> > Where is RewriteRule in this file??
>
> I moved all the RewriteRule's from httpd.conf to .htaccess
> and restarted Apache, but it still doesn't work.
Well, all you need to do is :
1. in httpd.conf uncomment this line :LoadModule rewrite_module
modules/mod_rewrite.so
2 to .htaccess put in:
RewriteEngine on
RewriteRule ^tag/(.*)$ /tag/yourscript.php?foo=$1 [L]
Re: How to process http://MYURL/tag/foo
am 30.10.2007 20:55:45 von para.keet6
> Well, all you need to do is :
> 1. in httpd.conf uncomment this line :LoadModule rewrite_module
> modules/mod_rewrite.so
> 2 to .htaccess put in:
>
> RewriteEngine on
> RewriteRule ^tag/(.*)$ /tag/yourscript.php?foo=$1 [L]
Yep, that's what I've got.
Perhaps under Windows it's not OK to put
..htaccess at c:\ ?
Re: How to process http://MYURL/tag/foo
am 30.10.2007 21:15:12 von clbr
On Oct 30, 7:55 pm, para.ke...@yahoo.com wrote:
> > Well, all you need to do is :
> > 1. in httpd.conf uncomment this line :LoadModule rewrite_module
> > modules/mod_rewrite.so
> > 2 to .htaccess put in:
>
> > RewriteEngine on
> > RewriteRule ^tag/(.*)$ /tag/yourscript.php?foo=$1 [L]
>
> Yep, that's what I've got.
>
> Perhaps under Windows it's not OK to put
> .htaccess at c:\ ?
Place .htaccess in root folder of your web aplication.
Re: How to process http://MYURL/tag/foo
am 30.10.2007 21:40:05 von para.keet6
>
> Place .htaccess in root folder of your web aplication.
I did, and I re-verified that its permissions are 777
(turns out that VIM for Windows sets them to 700),
and then I restarted. It still doesn't work.
Re: How to process http://MYURL/tag/foo
am 30.10.2007 21:45:37 von clbr
On Oct 30, 8:40 pm, para.ke...@yahoo.com wrote:
> > Place .htaccess in root folder of your web aplication.
>
> I did, and I re-verified that its permissions are 777
> (turns out that VIM for Windows sets them to 700),
> and then I restarted. It still doesn't work.
Just drop me an email with .htaccess and httpd.conf.
grrrrrrrrrrrrrr....:)
Re: How to process http://MYURL/tag/foo
am 31.10.2007 11:53:06 von Kees Nuyt
On Tue, 30 Oct 2007 06:33:10 -0700, para.keet6@yahoo.com
wrote:
>Hi all,
>
>I want to set up my Apache server so that I can have
>a script process URLs like http://MYURL/tag/foo,
>such that a script named tag will receive the word
>"foo" as a parameter.
>
>Anybody know how this can be done?
>
>Thanks.
Define this in the directory where you need it, in your
case "/"
ForceType application/x-httpd-php
In this case, your script is tag (not tag.php).
The tag script can extract the parameters behind /tag/
from the $_SERVER['PATH_INFO'] global variable.
I found it here:
http://richardlynch.blogspot.com/2006/06/php-downloads-conte nt-disposition.html
You goal is a bit different than his, but the same
technique will work.
In my opinion this is faster and easier than rewrites.
--
( Kees
)
c[_] A good pun is its own reword. (#289)