开发者

htaccess redirection with variables

Can someone help me with this? What I'm trying to do is redirect开发者_Go百科 -

http://www.domain.com/testpage 

to

http://www.domain.com/index.php?id=testpage

if that page does not exist on server.


Using .htaccess and RewriteRule

# -f means "is it a file" !-f "not(is it a file)"
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php?/id=$1 [L]
# RewriteRule takes a regular expression and an output followed by
# a set of instructions in the brackets.
# in this case, we're saying, 'take anything not found and add it to index.php?id=
# [L] means that this should be considered a final instruction -- no more rules
# should apply here.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜