简体   繁体   中英

.htaccess redirect everything to new domain except one URL to something different

I am 301 redirecting everything from http://something.org/* to https://something.com/* with this code...

<IfModule mod_rewrite.c>
    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule (.*) https://www.something.com/$1 [R=301,L]
</IfModule>

I am trying to add exception that this URL http://something.org/registration/service redirects to http://www.something.com/registration/service (not HTTPS like general rule). Tried this to exclude this url from general rule and it works, but I don't know how to add rule to redirect this exclusion to something else:

<IfModule mod_rewrite.c>
    Options +FollowSymLinks
    RewriteEngine on
    RewriteCond %{REQUEST_URI} !^/registration/service
    RewriteRule (.*) https://www.dewesoft.com/$1 [R=301,L]
</IfModule>

用这个替换你的 RewriteCond :

RewriteRule ^registration/service http://example.com%{REQUEST_URI} [NE,L,R]

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