I'm writing a script that (I hope) will be widely distributed and I want make sure that it will work on as many servers as possible out of the box.
This script will require an .htaccess file but I've learned some htaccess files are not very portable.
The htaccess needs to do a si开发者_Go百科mple redirect, like so:
http://example.com/dir/string
Redirect to...
http://example.com/dir/index.php?string
What would a 'universal' .htaccess file look like that would work on all windows and linux servers.
Try this...
RewriteEngine On
# if the file|folder exists
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/(.*)$ /$1/index.php?$2 [L,QSA]
精彩评论