以下是我所说的:
localhost/add.php -> localhost/add
localhost/1234/ -> localhost/view.php?id=1234
我尝试过:
RewriteRule (.*)$ /view.php?id=$1
RewriteRule (.*) $1.php [L]
答案 0 :(得分:0)
这是你要找的吗?
Options -MultiViews
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+) view.php?id=$1&%{QUERY_STRING} [L]