Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 1st, 2012  |  syntax: None  |  size: 0.86 KB  |  hits: 110  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. mod_rewrite rule to modify the url
  2. RewriteEngine on
  3. RewriteBase /
  4.  
  5. #redirect to remove comment.php
  6. RewriteCond %{THE_REQUEST} ^[A-Z]{3,9} /comment.php?id=([^ &]+)  [NC]
  7. RewriteRule ^ %1? [L,R=301]
  8.  
  9. <IfModule mod_rewrite.c>
  10. RewriteRule ^([a-zA-Z0-9_]+)$ /comment.php?id=$1 [L]
  11. </IfModule>
  12.        
  13. mysite.com/comment.php?id=sfaslfjkj12
  14.        
  15. mysite.com/sfaslfjkj12
  16.        
  17. mysite.com/comment.php?id=sfaslfjkj12&info=subject_content_overhere
  18.        
  19. mysite.com/comment/sfaslfjkj12/subject_content_overhere
  20.        
  21. RewriteEngine on
  22. RewriteBase /
  23.  
  24. #redirect mysite.com/comment.php?id=myid&info=myinfo to mysite.com/myid/myinfo
  25. RewriteCond %{THE_REQUEST} ^[A-Z]{3,9} /comment.php?id=([^ &]+)&info=([^ &]+)  [NC]
  26. RewriteRule ^ %1/%2? [L,R=301]
  27.  
  28. #rewrite mysite.com/myid/myinfo to mysite.com/comment.php?id=myid&info=myinfo
  29. RewriteRule ^([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)$ /comment.php?id=$1&info=$2 [L]