问题
I want to redirect
www.domain.com/abc
to
www.domain.com/index.php?a=abc
only if the folder abc doesn't already exist. How should I write the .htaccess file?
回答1:
Try
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/(.*)$ http://www.domain.com/index.php?a=$1 [L]
来源:https://stackoverflow.com/questions/13264690/htaccess-redirect-non-existing-pages-only-keeping-the-token