I am a little bit confused and still learning on how to rewrite in Apache htaccess
How can I turn this:
http://www.mydomain.com/dir1/post.php?%20id=1
into this:
http://www.mydomain.com/category1/post/1
This is my reference, I'm not sure if I am doing it correctly
<a href='http://www.mydomain.com/dir1/post.php? id=$id'>
You can use a simple rewrite rule if you only need to rewrite a single URL.
RewriteRule ^dir1/post.php?%20id=1 category1/post/1 [L]
or you may need to replace the %20 with the whitespace character regex
RewriteRule ^dir1/post.php?[\s]id=1 category1/post/1 [L]
You will need to make sure mod_rewrite is on as well ('RewriteEngine On' in .htaccess).
Here is a good tut: http://coding.smashingmagazine.com/2011/11/02/introduction-to-url-rewriting/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.