Using mod_rewrite On Form Parameters


/ Published in: Apache
Save to your folder(s)

Great way to use mod_rewrite with friendly URLs and Form


Copy this code and paste it in your HTML
  1. <IfModule mod_rewrite.c>
  2. Options +FollowSymLinks
  3. RewriteEngine On
  4.  
  5. RewriteCond %{REQUEST_URI} /search.php$
  6. RewriteCond %{QUERY_STRING} ^q=([A-Za-z0-9\+]+)&s=Search$
  7. RewriteRule ^(.*)$ /s-%1? [R=301,L]
  8.  
  9. RewriteRule ^s-(.*)$ /search.php?q=$1&s=Search&a=1 [L]
  10. </IfModule>

URL: http://www.talkincode.com/using-mod_rewrite-on-form-parameters-89.html

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.