我想从http或https重定向到新网站。
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}/index.html !-f
RewriteCond %{REQUEST_FILENAME}/index.php !-f
RewriteRule . index.php [L]
Redirect /abc https://www.newdomain.com/abc
这有效 - http://www.olddomain.com/abc
但这得到了404- https://www.olddomain.com/abc。在
答案 0 :(得分:0)
You should use a rewrite since you're already using mod_rewrite and it should go before your other rules. If you are redirecting to a new domain, the other rules probably don't need to be there anymore any.
RewriteEngine On
RewriteBase /
#redirect to new domain
RewriteRule ^(.*)$ https://www.newdomain.com/$1 [R=301,L]
#other rules you probably do not need anymore
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}/index.html !-f
RewriteCond %{REQUEST_FILENAME}/index.php !-f
RewriteRule . index.php [L]