You are viewing this site as a guest. Join our community to get your questions answered and share knowledge. Active members may advertise and ask for a website critique.

How to define Custom variable in httpd.conf of Apache Http Server ?

They have: 1 posts

Joined: Dec 2008

Hi All ,

I need to write 14-15 rewrite rules in httpd.conf, in which i want to redirect some specific url patterns to other domain.

For Ex.
RewriteRule ^/url-id$ http://www.abc.com/de/url-id

But i want to write it in generic way so that i can change domain abc.com to any test.abc.com.
For that i need to change all 14-15 rewrite rules. So is there any way to define custom variable in httpd.conf file so that i can assign destination host & can use it in rewrite rule like in following .

ContentServer = http://www.abc.com
RewriteRule ^/url-id$ ${ContentServer}/de/url-id

So user can only change ContentServer property & it will reflect in all rewrite rule.

pr0gr4mm3r's picture

He has: 1,419 posts

Joined: Sep 2006

Try this:

SetEnv ContentServer "www.example.com"