Cyclone
Cyclone

Reputation: 18295

Rewrite only external requests to a certain URL

I want to rewrite from http://example.com/blah/<something>/<somethingelse> to http://<something>.example.com/<somethingelse>, but only if the request is not an internal redirect. How can I achieve this effect? I know I can use %{THE_REQUEST}, but I can't seem to find any good examples.

Thanks for the help!

Upvotes: 1

Views: 870

Answers (1)

outis
outis

Reputation: 77400

The no subrequest flag ([NS]) will skip rules on internal sub-requests.

RewriteCond %{HTTP_HOST} =example.com
RewriteRule ^/?blah/(.*{]) http://something.example.com/$1 [NS,L]

Upvotes: 1

Related Questions