Hello i want to rewrite the following link:

http://websoftit.ro/social/profil.php?user=Ancuta Mirela

to http://websoftit.ro/social/Ancuta Mirela.
Can someone tell me how to do that with mod_rewrite also maybe give me a link to a good documentation to learn myself how to do that?
Thnx in advance.


Solution:

You can use this code in your DOCUMENT_ROOT/.htaccess file:

RewriteEngine On
RewriteCond %{THE_REQUEST} \s/+social/profil\.php\?user=([^\s&]+) [NC]
RewriteRule ^ /social/%1? [R=302,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^social/([^/]+)/?$ /social/profil.php?user=$1 [L,QSA]

I would suggest http://askapache.com as a good reference for learning mod_rewrite.


Related Wordpress search:

,

Wordpress related questions and answers: