Jump to content

Recommended Posts

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

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!)

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.

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 ?

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 ^_^

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.