如何在。htaccess文件中执行重定向,除了一个文件夹及其目录和文件和一个路径
我想按如下方式执行重定向从域
www.olddomain.org
www.olddomain.org/^ (any path)
to the domain:
www.newdomain.org
www.newdomain.org/^ (any path)
BUT except for
www.olddomain.org/administrator/test/test1/test2
www.olddomain.org/administrator/ (any path)
AND
www.olddomain.org/test-article
我想补充一下,我想为Joomla 3 CMS系统做这些重定向
我试一试:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^olddomain.pl
#redirect them to new-example
RewriteCond %{REQUEST_URI} !=/administrator/^
RewriteCond %{REQUEST_URI} !=/testarticle
RewriteRule (.*) https://newdomain.pl/$1 [R=301,L]
和
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/administrator.*/$ [NC]
RewriteRule .* https://www.newdomain.com/ [R=301,L]
但是它没有按我想要的方式工作
试试这个:
RewriteEngine On
RedirectMatch 301 ^/((?!administrator).*)$ http://newdomain.org/$1