0

Ok, Ive checked this site and still I am confused about how to do this...

I need to take a url like this

subdomain.domain.com/1234

and redirect to a url like this

http://assets.subdomain.domain/php/store.php?store_num=1234

utilizing the numbers after the slash as a get variable

Here is what I have in my .conf file so far.

<VirtualHost *:80>
  ServerName assets.subdomain.domain.com
  ServerAlias subdomain.domain.com/*
  VirtualDocumentRoot /var/www/html/prod/subdomain.domain.com/assets/

  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ http://assets.subdomain.domain/php/store.php?store_num=$1 [L,QSA]         
</VirtualHost>

As a side note, my .conf file is pretty big and has a lot of other vhosts in it, so I'm not sure if this isn't working because there is something else in the .conf file that is overwriting it.

Taylor
  • 1

1 Answers1

0

You need to enable mod_rewrite by adding a RewriteEngine directive.

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ http://assets.subdomain.domain/php/store.php?store_num=$1 [L,QSA]
bradym
  • 4,880
  • 1
  • 31
  • 36