image link mod rewrite

Discuss practical ways rearrange URLs using mod_rewrite.

image link mod rewrite

Postby yalamber » Tue Sep 02, 2008 9:00 am

Hello i have a image manupulation script. it sets the height width of the image.
The current link of the image is system/img.php?file=flename&width=width.
What i want to do is get a static url for this image link. Is it possible with following rule:

Code:

RewriteRule ^userimg/([A-Za-z0-9-]+)/([0-9]+)$ /system/img.php?file=$1&width=$2 [QSA,L]
yalamber
 
Posts: 15
Joined: Fri Sep 07, 2007 12:52 am
Location: biratnagar

Postby richardk » Tue Sep 02, 2008 11:59 am

Do yo want the static URL to be /userimg/filename/width?
Your filenames will probaby include "."s so [A-Za-z0-9-] won't match them.

Try
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteRule ^userimg/([^/]+)/([0-9]+)$ /system/img.php?file=$1&width=$2 [QSA,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 14 guests

cron