tags:

views:

26

answers:

2

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?

A: 

Give this a go :)

RedirectMatch 301 /upload/(.*)$ http://www.yoursite.com/upload.php?what=$1

I think that should do it.

Wolfy87
It might need a bit of tweeking such as upload/ rather than /upload/ and obviously change yoursite.com to, well, your site.
Wolfy87
I don't want to redirect to that page, I want apache to understand /upload/something as /upload.php?what=something
Octavian
+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
thanks. This rewrite rule I was looking for.
Octavian