mod rewrite - .htaccess modification -


i using direct paths downloading files site. link this

http://www.site.com/download.php?dir1/dir/dir3/file.doc

i want wrap mod rewite rules below link should appeared

http://www.site.com/download

file, dir , dir3 variable. i'hv in .htaccess file?? idea??

a simple redirect be:

rewriterule ^http://www.site.com/download/(.*)/?$ http://www.site.com/download.php?dir1/dir/dir3/$1 [nc,l]  

this take request in 'artificial' download directory , route real location.

you can add more complex rules stripping out filetypes etc depending on needs, or redirecting 'name' filename etc etc..

e.g:

rewriterule ^http://www.site.com/download/pdf/(.*)/?$ http://www.site.com/download.php?dir1/dir/dir3/$1.pdf [l,nc] 

this have artificial pdf folder containing filename ex extension, routing .pdf doc....you can shape redirect way really...depends on format prefer


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -