> ## Content Index
> Fetch the complete content index at: https://kudithipudi.org/llms.txt
> Use this file to discover other available public pages before exploring further.

# HOW TO : Redirect web traffic based on URL patterns in Apache
- URL: https://kudithipudi.org/how-to-redirect-web-traffic-based-on-url-patterns-in-apache/
- Published: 2012-04-09T23:27:51.000Z
- Updated: 2012-04-09T23:27:51.000Z
- Description: Apache configuration to redirect traffic to a particular URL based on the pattern in the URL (AKA URI). In this particular example, I want to redirect...
- Author: admin
- Tags: HOWTO, Uncategorized, Web, #wp, #wp-post, #Import 2026-08-23 02:32

Apache configuration to redirect traffic to a particular URL based on the pattern in the URL (AKA URI). In this particular example, I want to redirect any traffic that does not have the URL starting with /application or /content to redirect to https://domain\_name/application

- Enable the [rewrite module](https://kudithipudi.org/content/files/httpd-apache-org/docs/2-0/mod/mod%5Frewrite.xml) in Apache

Add the following conditions in the conf file

```
RewriteCond %{REQUEST_URI} !^/(application|content) [NC]
RewriteRule ^/(.*) https://%{HTTP_HOST}/application [R,L]
```

Explanation of the rule

- ! implies match if the string is not found
- ^ implies start of string
- | implies OR
- \[NC\] implies not case sensitive (no case)
- The rule will be triggered if the conditions match
- \[R,L\] means external (client side) redirection and last rule to process