cmpscabral
cmpscabral

Reputation: 183

htaccess conditional statements based on server name/path

Is it possible to write some conditional "if" statements in htaccess based on the server name/path?

I know I can use <IfModule> but that doesn't solve the problem when the development and production server are identical.

thanks

Upvotes: 4

Views: 3925

Answers (1)

Gumbo
Gumbo

Reputation: 655239

You can test the value of SERVER_NAME or DOCUMENT_ROOT:

RewriteCond %{SERVER_NAME} =foo
RewriteRule …
RewriteCond %{DOCUMENT_ROOT} =/path/to/document/root/
RewriteRule …

Upvotes: 5

Related Questions