Mod-rewrite question: convert static URL to dynamic for dynamic signatures

Hey there, I want to create a mod_rewrite rule to allow dynamic signatures.

Here is the client URI: http://www.somesite.com/pilot1.png
Here is the rewritten URI: http://www.somesite.com/sigs/sig.php?id=pilot1.png

Also please include which .htaccess file(s) needs modifying.

Thanks.
Dodger42Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

 
Dodger42Author Commented:
No response so points bumped up.
0
 
Tol_cvCommented:


if you want it for png extension only, you can try something like :


RewriteRule ^(.*)\.png$  http://www.somesite.com/sigs/sig.php?id=$1\.png
more info on  url rewriting:
http://rosebud.stanford.edu/manual/misc/rewriteguide.html
0
 
Dodger42Author Commented:
Ok that redirect is kind of working, but there is an extra slash in there after the = sign:

http://192.168.0.250/sigs/sig.php?id=/42SF-Dodger

"/42SF-Dodger" should be "42SF-Dodger"
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

 
Tol_cvCommented:

to eliminate the slash:

RewriteRule ^/(.*)\.png$  http://www.somesite.com/sigs/sig.php?id=$1\.png
0

Experts Exchange Solution brought to you by ConnectWise

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
 
Dodger42Author Commented:
One more thing. If I only want this rule to take place if the request is in the / directory, do I just put that rule int he directory section for /?

Thanks
0
 
Tol_cvCommented:
you can use:

RewriteRule ^/(.+[^/])\.png$  http://www.somesite.com/sigs/sig.php?id=$1\.png
(.+[^/])  where  matches everything , exept string that contains /

it doesn't help to use  RewriteRulele  ^/(.*)\.png$  http://www.somesite.com/sigs/sig.php?id=$1\.png   in <directory> section.   A rule is used in non-server context  if you add it to  a .htaccess file.

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.