regex - How to redirect to a different domain EXCEPT when url matches certain patterns -


i have following rule in .htaccess file should redirect request this:

http://www.olddomain.com/some/url/ -> http://www.newdomain.com/some/url/

unless path matches /images/someimage.jpg

there's few exceptions this, built rule:

rewriterule ^(?!images/.*|css/.*|js/.*) http://www.newdomain.com/$1 [r=301,l] 

this behaving expected when test using http://htaccess.madewithlove.be/

but, on live server, $1 never set. urls match pattern redirected home page "/"

this first rule of htaccess file, after rewriteengine on

replace rule this:

rewritecond %{http_host} ^(www\.)?olddomain\.com$ [nc] rewritecond %{request_uri} !^/((images|css|js)/ [nc] rewriterule ^ http://www.newdomain.com%{request_uri} [r=301,l] 

Comments

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

c++ - Correct method for redrawing a layered window -

java.util.scanner - How to read and add only numbers to array from a text file -