xstoryteller Posted February 5, 2008 Share Posted February 5, 2008 Oke so I want to go from http://www.domain.com/sig/Name,Job,Level,Clan,base3,200,200,20.png to http://www.domain.com/sig/sig.png?img=xStoryTeller,Scout,165,Religion,base3,200,200,20 So basicly it takes "Name,Job,Level,Clan,base3,200,200,20.png", from behind "http://www.domain.com/sig/" strips the ".png" at the end and adds "sig.png?img=" infront of it, yet I cant seem to do it :x Could anyone give me the RewriteRule for it ? And maybe explain it? I've been searching alot but I just cant put it together ._. Link to comment https://forums.phpfreaks.com/topic/89632-solved-need-help-with-my-rewriterule/ Share on other sites More sharing options...
powerspike Posted February 6, 2008 Share Posted February 6, 2008 RewriteRule ^sig/([a-zA-Z0-9]+),([a-zA-Z0-9]+),([a-zA-Z0-9]+),([a-zA-Z0-9]+),([a-zA-Z0-9]+),([a-zA-Z0-9]+),([a-zA-Z0-9]+),([a-zA-Z0-9]+).png sig/sig.php?img=$1,$2,$3,$4,$5,$6,$7,$8 [L] i'm not sure how the comma's will work, you might want to exchange them for -, i'm not at my desk right now, so i can't lookup the rewrite doc's. But that should hopefully work (done off the top of my head!) Link to comment https://forums.phpfreaks.com/topic/89632-solved-need-help-with-my-rewriterule/#findComment-459549 Share on other sites More sharing options...
xstoryteller Posted February 6, 2008 Author Share Posted February 6, 2008 Oke so I placed this in my .htaccess file RewriteEngine on RewriteRule ^sig/([a-zA-Z0-9]+),([a-zA-Z0-9]+),([a-zA-Z0-9]+),([a-zA-Z0-9]+),([a-zA-Z0-9]+),([a-zA-Z0-9]+),([a-zA-Z0-9]+),([a-zA-Z0-9]+).png sig/sig.php?img=$1,$2,$3,$4,$5,$6,$7,$8 [L] Saved it, uploaded it to my domain/sig folder, so I went to http://www.domain.com/sig/xStoryTeller,Scout,165,Religion,base3,200,200,200.png wich throws a 404 error: The requested URL /sig/xStoryTeller,Scout,165,Religion,base3,200,200,200.png was not found on this server. While when I go to http://www.domain.com/sig/sig.php?img=xStoryTeller,Scout,165,Religion,base3,200,200,200.png it does work, so I guess it didnt work ? :x I also try'd to replace the "," with the "-" in the .htaccess file and the link in my browser, same 404. Link to comment https://forums.phpfreaks.com/topic/89632-solved-need-help-with-my-rewriterule/#findComment-459581 Share on other sites More sharing options...
xstoryteller Posted February 6, 2008 Author Share Posted February 6, 2008 Oke I fixed it thanks to the code provided by powerspike, there was one error in his I think, after the .png there was no $ ( for ending the string ), and I had sig/... but I placed the .htaccess file in the sig folder, so I didnt need that /sig. Hope thats clear lol anyway here is the script I now use. RewriteEngine on RewriteRule ^([a-zA-Z0-9]+),([a-zA-Z0-9]+),([a-zA-Z0-9]+),([a-zA-Z0-9]+),([a-zA-Z0-9]+),([a-zA-Z0-9]+),([a-zA-Z0-9]+),([a-zA-Z0-9]+).png$ sig.php?img=$1,$2,$3,$4,$5,$6,$7,$8 [L] Only problem now is I cant use spaces ? Link to comment https://forums.phpfreaks.com/topic/89632-solved-need-help-with-my-rewriterule/#findComment-460054 Share on other sites More sharing options...
xstoryteller Posted February 6, 2008 Author Share Posted February 6, 2008 For some reason I cant edit ? Ahh well, I solved it anyway changed [a-zA-Z0-9] to . so it went to (.+) instead of ([a-zA-Z0-9]+) wich did the trick, I used htmlspecialchars and stripslashes in my php for security, thanks problem solved Link to comment https://forums.phpfreaks.com/topic/89632-solved-need-help-with-my-rewriterule/#findComment-460119 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.