Is it possible to associate /upload/picture to /upload.php?what=picture with htaccess?
Is it possible to associate /upload/picture to /upload.php?what=picture with htaccess and when I submit a fo开发者_如何学JAVArm to /upload/picture it is taken by the upload.php? If it is, how?
The question is slightly awkwardly worded, but if I understand you correctly, what you're looking for is called mod_rewrite.
mod_rewrite is a plug-in for the Apache web server which allows you to change your old-style query URLs into other formats. You will need to have mod_rewrite installed to be able to use it, obviously. Most Apache installs these days do include it by default, though.
mod_rewrite commands are entered into your htaccess file. Something like this should do it for you (but note that I haven't tested this! you may need to tweak it!):
RewriteEngine on
RewriteRule ^upload/([^/\.]+)/?$ upload.php?what=$1 [L]
Give this a go :)
RedirectMatch 301 /upload/(.*)$ http://www.yoursite.com/upload.php?what=$1
I think that should do it.
精彩评论