我需要RewriteRules
接受类似的内容:
mysite/courses going to mysite/index.php?page=courses
mysite/courses/add going to mysite/index.php?page=courses&action=add
mysite/courses/edit/3 goint to mysite/index.php?page=courses&action=edit&id=3
目前,我正在使用:
RewriteEngine On
RewriteRule %{REQUEST_FILENAME} !-f
RewriteRule %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !\.(php|html?|jpg|gif|js|css)$
RewriteRule ^([^/]*)/([^/]*)/([^/]*)$ index.php?page=$1&action=$2&id=$3
但是,当我尝试不起作用的mysite / courses /时。
此致
答案 0 :(得分:1)
我得到了这个.htaccess
RewriteEngine On
RewriteRule %{REQUEST_FILENAME} !-f
RewriteRule %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !\.(php|html?|jpg|gif|js|css)$
RewriteRule ^([^/]*)/?([^/]*)/?([^/]*)$ index.php?page=$1&action=$2&id=$3