Dodger42
asked on
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.
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.
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
ASKER
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"
http://192.168.0.250/sigs/sig.php?id=/42SF-Dodger
"/42SF-Dodger" should be "42SF-Dodger"
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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
Thanks
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.
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.
ASKER