简体   繁体   中英

Wordpress redirect in htacess not working

I know there is many questions like this, but i've been trying this for over 3 days now and still no success. I have wordpress site which i want to redirect entirnely to another site besides one url: www.oldsite.com/adv

If i setup normal redirect for entire site it works but when I try to excluce certain folder from redirecting it refuses to work.

I have tried following code in my htacess file:

RewriteEngine on
RewriteCond %{REQUEST_URI} !^/adv
RewriteRule (.*) http://www.newsite.com/$1 [R=301,L].  

but this redirects all pages from oldsite including oldsite.com/adv

also I have tried:

Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI}!^/my-folder/
RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]

but this one gives 500 error.

do you have an idea what am i doing wrong?

RewriteEngine on
RewriteRule ^adv - [L,NC] 
RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]

It will match any URI beginning adv.

  • The - means do nothing.
  • The L means this should be last rule; ignore everything following.
  • The NC means no-case (so "ADV" is also matched).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM