Forum Moderators: phranque

Message Too Old, No Replies

Mod rewrite rule help needed!

mod_rewrite

         

smoothy

1:47 pm on Oct 27, 2009 (gmt 0)

10+ Year Member



Hi,

I have one script which has the following rewrite rule which is coded by the developer only for lighttpd webserver.

Can anyone convert the same rewrite rule in apache format?

url.rewrite-once = ( "^/files/(.*)/(.*)" =>"/files.php?id=$1&filename=$2" )

Waiting for ur reply,
Thanks.

jdMorgan

1:55 pm on Oct 27, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That's some very inefficient code... For better server performance, I'd strongly suggest changing that to

url.rewrite-once = ( "^/files/([^/]+)/(.*)" =>"/files.php?id=$1&filename=$2" )

The Apache mod_rewrite equivalent would likely be

RewriteRule ^/files/([^/]+)/(.*)$ /files.php?id=$1&filename=$2 [L]

assuming that this code goes into a server config file, and outside of any <Directory> container. If for use in .htaccess or within a server config file <Directory> container, you must remove the leading slash from the RewriteRule pattern.

Please review our Forum Charter for useful references and information about how to get the most from this forum.

Jim

smoothy

5:23 pm on Oct 27, 2009 (gmt 0)

10+ Year Member



thanks for ur help .. will try and reply back!