Apache mod rewrite url htaccess -


i little bit confused , still learning on how rewrite in apache htaccess

how can turn this:

http://www.mydomain.com/dir1/post.php?%20id=1

into this:

http://www.mydomain.com/category1/post/1

this reference, i'm not sure if doing correctly

<a href='http://www.mydomain.com/dir1/post.php? id=$id'> 

you can use simple rewrite rule if need rewrite single url.

rewriterule ^dir1/post.php?%20id=1 category1/post/1 [l] 

or may need replace %20 whitespace character regex

rewriterule ^dir1/post.php?[\s]id=1 category1/post/1 [l] 

you need make sure mod_rewrite on ('rewriteengine on' in .htaccess).

here tut: http://coding.smashingmagazine.com/2011/11/02/introduction-to-url-rewriting/


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -