Is it possible to associate /upload/picture to /upload.php?what=picture with htaccess and when I submit a form to /upload/picture it is taken by the upload.php? If it is, how?
views:
26answers:
2
A:
Give this a go :)
RedirectMatch 301 /upload/(.*)$ http://www.yoursite.com/upload.php?what=$1
I think that should do it.
Wolfy87
2010-09-23 14:28:17
It might need a bit of tweeking such as upload/ rather than /upload/ and obviously change yoursite.com to, well, your site.
Wolfy87
2010-09-23 14:31:29
I don't want to redirect to that page, I want apache to understand /upload/something as /upload.php?what=something
Octavian
2010-09-23 14:39:22
+2
A:
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]
Spudley
2010-09-23 14:33:47