Jump to content

[SOLVED] Need help with my RewriteRule


xstoryteller

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 ?

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.