1

I need to rewrite my url

http://midogames.com/game.php?id=%D9%84%D8%B9%D8%A8%D8%A9%20%D8%B5%D8%A7%D8%A6%D8%AF%20%D8%A7%D9%84%D8%B0%D9%87%D8%A8

to

http://midogames.com/%D9%84%D8%B9%D8%A8%D8%A9%20%D8%B5%D8%A7%D8%A6%D8%AF%20%D8%A7%D9%84%D8%B0%D9%87%D8%A8

"please note they are spaces in the link" i am doing this

<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/\.]+) /game.php?id=$1 [NC,L]
</IfModule>

but it did not work with me, any suggetion

1
  • RewriteRule FROM TO - you should match with FROM and rearange in TO - your code does the opposite of what you want (you rewrite to /game.php) Commented Aug 10, 2014 at 9:03

1 Answer 1

1

Try with NE flag:

Options +FollowSymLinks
RewriteEngine On
RewriteBase /

RewriteCond %{THE_REQUEST} \s/+game\.php\?id=([^\s&]+) [NC]
RewriteRule ^ /%1/? [R=302,L,NE]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+?)/?$ game.php?id=$1 [NE,L,QSA]
Sign up to request clarification or add additional context in comments.

11 Comments

That type of comment never helps, you need to provide all the details. What url did you use to test it? And where is your .htaccess located?
sorry man, i use the same url as in my question and the .htaccess in the root of midogames.com
There is a reason I suggested you provide details. Your question has 2 URLs http://midogames.com/game.php?id=%D9%84%D8%B9%D8%A8%D8%A9%20%D8%B5%D8%A7%D8%A6%D8%AF%20%D8%A7%D9%84%D8%B0%D9%87%D8%A8 AND http://midogames.com/%D9%84%D8%B9%D8%A8%D8%A9%20%D8%B5%D8%A7%D8%A6%D8%AF%20%D8%A7%D9%84%D8%B0%D9%87%D8%A8 now you tell me which one did you use to test? Also do you more rules in your .htaccess?
i use midogames.com/… no more rules
did u have any idea how can i replace 20% "space" by slash -
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.