Quantcast
Channel: My Science Is Better » Apache
Viewing all articles
Browse latest Browse all 2

Redirect entire site to another domain, excluding folder

$
0
0

A site i’ve built for a campaign needed to be redirected to another site as the campaign expired, but one folder in the domain needed still to be accessible. htaccess to the rescue:

RewriteEngine on
RewriteRule !^uploads($|/) http://example.com%{REQUEST_URI} [L,R=301]

This rule does match any URL path that does not begin with either /uploads or /uploads/ (leading / is missing in the pattern due to the path prefix removal when used in .htaccess files) and redirects the request to the corresponding path at example.com.


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images