2
有人可以幫助我嗎?我想要做的是重定向 -htaccess與變量的重定向
http://www.domain.com/testpage
到
http://www.domain.com/index.php?id=testpage
如果該頁面不上服務器存在。
有人可以幫助我嗎?我想要做的是重定向 -htaccess與變量的重定向
http://www.domain.com/testpage
到
http://www.domain.com/index.php?id=testpage
如果該頁面不上服務器存在。
使用.htaccess文件和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.