admincentralmail
asked on
Modrewrite
Hi, I want change with mod rewritte all the entry request like this:
http://thumbs.domain.com/attachment.php?id=12345&name=005.jpg
By this:
http://thumbs.domain.com/1/2/3/4/5/005.thumb
Ineed the code to do this in apache,
Thanks!!
http://thumbs.domain.com/attachment.php?id=12345&name=005.jpg
By this:
http://thumbs.domain.com/1/2/3/4/5/005.thumb
Ineed the code to do this in apache,
Thanks!!
#!/usr/bin/perl
$! = 1;
while (<>)
{
print(join("/", split(//, $_)) . "\n"); #forgot the newline, sorry
}
$! = 1;
while (<>)
{
print(join("/", split(//, $_)) . "\n"); #forgot the newline, sorry
}
ASKER
I have a old php to send the thumbnails, but I want link direct to the thumbnails.
the .thumb is a .jpg
With this code I can put in the apache config and apache rewrite and convert:
http://thumbs.domain.com/attachment.php?id=12345&name=005.jpg
to this:
http://thumbs.domain.com/1/2/3/4/5/005.thumb
??
the .thumb is a .jpg
With this code I can put in the apache config and apache rewrite and convert:
http://thumbs.domain.com/attachment.php?id=12345&name=005.jpg
to this:
http://thumbs.domain.com/1/2/3/4/5/005.thumb
??
I haven't tested that, but should work. Test it.
ASKER
Do you know the code to do this:
#!/usr/bin/perl
$! = 1;
while (<>)
{
print(join("/", split(//, $_)));
}
Without a perl, only with RewriteCond
#!/usr/bin/perl
$! = 1;
while (<>)
{
print(join("/", split(//, $_)));
}
Without a perl, only with RewriteCond
No, thats why there's RewriteMap option.
RewriteCond/Rule only matches some patterns - do not modify them.
RewriteCond/Rule only matches some patterns - do not modify them.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
RewriteEngine On
RewriteBase /
RewriteMap splitDigits prg:/path/to/splitter
RewriteCond %{QUERY_STRING} id=(\d+) [AND]
RewriteCond %{QUERY_STRING} name=(\d+)
RewriteRule ^attachment.php ${splitDigits:%1}/%2.thumb
And the /path/to/splitter should be executable and should look like
#!/usr/bin/perl
$! = 1;
while (<>)
{
print(join("/", split(//, $_)));
}