我试图获得以下效果:
现在,我必须为我想要的每个网址添加以下内容,而我需要2-3行.htaccess来完成这项工作。 (如果可能的话,更多的是好的,我对.htaccess不太好)
RewriteRule ^login/submit$ login.php?action=submit
答案 0 :(得分:3)
试试这个并告诉我。
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^profile/([^/])/? profile.php?username=$1 [L,NC]
RewriteRule ^login/submit$ login.php?action=submit [L,NC]
# /login/ will go to login.php or /contact/ will go to contact.php
RewriteRule ^([a-z0-9_\-]+)/? $1.php [L,NC]
以下是有关[]
标志的完整文档:http://httpd.apache.org/docs/2.3/rewrite/flags.html