1

I have this situation:

http://www.site.asd/folder

Inside FOLDER I have one file getting content from other folder outside of it.

I need to get all traffic like "http://www.site.asd/folder/data1/data2/data3/data4.ext" and get this call "http://www.site.asd/folder/file.php?d1=data1&d2=data2&d3=data3&d4=data4.ext" without changing URL

This is what I made... and isn't working... :'(

RewriteEngine On
RewriteRule ^/folder/([^/]+)/([^/]+)/([^/]+)/(.*)$ /folder/file.php?d1=$1&d2=$2&d3=$3&d4=$4 [L,QSA]

Any advice/solution to make this work?

Thanks to all!

DigitalDaigor
  • 432
  • 3
  • 12
  • you can have a look at these http://stackoverflow.com/questions/10183022/how-can-i-redirect-all-files-in-one-directory-to-another-directory and http://stackoverflow.com/questions/1975904/htaccess-to-redirect-all-traffic-to-one-page-410-gone – user3470953 Apr 28 '14 at 05:54

3 Answers3

0

It might work

RewriteEngine On
RewriteRule ^/folder/([^/]+)/([^/]+)/([^/]+)/(.*)$ /folder/file.php?d1=$1&d2=$2&d3=$3&d4=$4 [QSA,L]
vimal1083
  • 8,499
  • 6
  • 34
  • 50
0
RewriteEngine On
RewriteBase /folder/

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l

RewriteRule ^(.*)$/folder/file.php?d1=$1&d2=$2&d3=$3&d4=$4 [QSA,L]

this should work, just point the rewriteBase to the folder you want

ibonly
  • 133
  • 1
  • 3
  • 10
0

You need to remove leading slash from your matching pattern. As .htaccess is per directory directive and Apache strips the current directory path (thus leading slash) from RewriteRule URI pattern.

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^folder/([^/]+)/([^/]+)/([^/]+)/(.*)$ /folder/file.php?d1=$1&d2=$2&d3=$3&d4=$4 [L,QSA]

Make sure this rule is in DocumentRoot/.htaccess.

anubhava
  • 761,203
  • 64
  • 569
  • 643