我有这样的链接: http://localhost/dimi/home?go=post&app=tagline&post_id=222
如何重写网址如下: http://localhost/dimi/home/post/tagline/222
尝试的是:
RewriteEngine On
RewriteRule ^home$ home.php [L]
RewriteRule ^home/([^/]+)/?$ home.php?go=$1 [L,NC]
我只是想出于安全目的隐藏变量。
谢谢
答案 0 :(得分:1)
在dimi目录中尝试这样。
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([\w-]+)/([\w-]+)/([\w-]+)/([\d]+)$ $1.php?go=$2&app=$3&post_id=$4 [QSA,NC,L]