1

I'am trying to write a rewrite rule and I would like to change this:

http://domain.de/adServer/js/first/sec/ADTECH?loc=300&alias=Home&misc=1429871690242

to:

http://domain.de/adServer/js/ADTECH.php?a=$1&b=$2

where $_Get in ADTECH.php shout be:

$_GET['a']=first | $_GET['b']=sec | $_GET['loc']=300 | $_GET['alias']=Home

The .htaccess-file will be placed in root/adServer/js. I tryed this without success:

RewriteEngine On
Options +FollowSymlinks 
RewriteBase / 

RewriteCond %{REQUEST_URI} /adServer/js/(.*)/(.*)/ADTECH$ 
RewriteRule (.*)/(.*)/ADTECH$ /adServer/js/test.php?a=$1&b=$2 

(My code brings the $_GET['a']=first | $_GET['b']=sec as new parameters but whats to do with the given parameters?)

anubhava
  • 761,203
  • 64
  • 569
  • 643
hamburger
  • 1,339
  • 4
  • 20
  • 41

1 Answers1

0

You can use this code in /adServer/js/.htaccess:

RewriteEngine On
Options +FollowSymlinks 
RewriteBase /adServer/js/ 

RewriteRule ^([^/]+)/([^/]+)/ADTECH/?$ test.php?a=$1&b=$2 [L,QSA,NC]

Changes are:

  1. Add required flags in RewriteRule. Esp important is QSA to preserve original query string.
  2. Add appropriate RewriteBase.
  3. Remove redundant RewriteCond
  4. Use relative path for rewriting in RewriteRule.
anubhava
  • 761,203
  • 64
  • 569
  • 643