嗨,我想问一下如何使用 .htaccess mod_write 将http://abc.tk/comments.php?post_referrel_id=16转换为http://abc.tk/comments.php?post_referrel_id/16表示用户看到此链接abc.tk/comments.php?post_referrel_id/16 当他单击源 abc.tk/comments.php?post_referrel_id=16 的超链接时
you need research, sir. check this easy tuto
And for your tips, don't use ?
in the rewritten url.
here is a quick code to do that (with ?
in the rewritten url)
RewriteEngine on
RewriteRule ^comment.php?post_referrel_id/([0-9]+)$ comment.php?post_referrel_id=$1
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^comments.php?post_referrel_id/(.*)$ comments.php/post_referrel_id=$1 [L,QSA]
You may have to add a redirect from one form to another. The above code just tells the server that the /16 is the same with =16
use these lines of code :
RewriteEngine on
RewriteCond %{HTTP_HOST} ^abc.tk
RewriteRule ^comments.php?post_referrel_id=([0-9]+)$ comments.php?post_referrel_id/$1 [R=301,L]
this will be redirect comments.php?post_referrel_id=16
to comments.php?post_referrel_id/16
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.