问题
I try redirect all pages to new domain exclude one page with htacces.
RewriteCond %{REQUEST_URI}!^/onepage.php/
RewriteRule (.*) http://newdomain.com/$1 [R=301,L]
This is working but page onepage.php show internal error 500
回答1:
You can try with either of the following in your .htaccess
file:
Example 1: Check the request URI for onepage.php
and redirect if it is not being requested:
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/onepage.php [NC]
RewriteRule ^(.*)$ http://newdomain.com/$1 [R=301,L]
Example 2: If onepage.php
is being requested, don't do anything. Otherwise, redirect:
RewriteEngine on
RewriteRule ^onepage\.php - [L]
RewriteRule ^(.*)$ http://newdomain.com/$1 [R=301,L]
As you're redirecting everything except for onepage.php
, you do not need any other rules in your file. The rules above should be the only ones in there.
来源:https://stackoverflow.com/questions/30029279/redirect-all-pages-to-new-domain-exclude-one-page-with-htacces