Apache2.2 mod_rewrite
Apache2.2 mod_rewrite
我有一个页面,想使用重写模块使 url 更加用户友好。我想重写这些(用户输入):
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 吗?
哦...同时 - 在我吃完午饭后 - 我解决了这个问题:
<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= [L]
</IfModule>
感谢您的关注! :)
我有一个页面,想使用重写模块使 url 更加用户友好。我想重写这些(用户输入):
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 吗?
哦...同时 - 在我吃完午饭后 - 我解决了这个问题:
<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= [L]
</IfModule>
感谢您的关注! :)