我有一个页面,并希望使用重写模块使网址更加用户友好。我想重写这些(用户输入):
http://domain.com/folder/page1
http://domain.com/folder/page2
http://domain.com/folder/pagen
..对于这些:
http://domain.com/folder/?id=page1
http://domain.com/folder/?id=page2
http://domain.com/folder/?id=pagen
你能帮我写一下.htaccess吗?
答案 0 :(得分:0)
噢......同时 - 我吃午饭后 - 我解决了问题:
<IfModule mod_rewrite.c>
RewriteEngine On
# If the requested url is not an existing file..
RewriteCond %{REQUEST_FILENAME} !-f
# .. neither an existing folder ..
RewriteCond %{REQUEST_FILENAME} !-d
# .. substitute it with the augmented index.php!
RewriteRule (.*) index.php?id=$1 [L]
</IfModule>
感谢您的关注! :)