How can I .htaccess 301 redirect all pages/files (EXCEPT FOR ONE) to new domain?

1 replies
How can I .htaccess 301 redirect all pages/files (EXCEPT FOR ONE) to new domain?

I have already made an .htaccess file that successfully redirects most all the different pages and files on my old domain (www.olddomain.com) to my new domain (www.newdomain.com).

HOWEVER, I need one page to NOT be redirected to the new site, that page is the google verification .html file:
Code:
http://www.olddomain.com/googleverification.html
.

I have attached the most relevant parts of the file are pasted below:

---------RELEVANT PARTS OF THE .HTACCESS FILE---------
Code:
RewriteEngine On

RewriteCond %{HTTP_HOST} ^olddomain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.olddomain.com$
RewriteRule ^(.*)$ http://www.newdomain.com/$1 [L,R=301]

RewriteCond %{REQUEST_URI}  !.(php|html?|jpg|gif|png|pdf|tiff|bmp|ico|gz|zip|xml|txt)$
RewriteRule ^(.*)([^/])$ http://www.newdomain.com/$1$2/ [L,R=301]


# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
#301 #domain #htaccess #pages or files #redirect
  • Profile picture of the author Weblin
    Code:
    RewriteEngine On
    Rewritecond %{http_host} ^olddomain.org [NC] 
    RewriteCond %{REQUEST_URI} !/(protectetfile1|protectetfile2).php [NC] 
    Rewriterule ^(.*)$ http://newdomain.net/$1 [L,R=301]
    Just replace it with the analytics file
    Signature
    www.HandleMySite.com handles your WordPress site by doing all of the maintenance and technical work for you. Making backups, managing updates, maintenance, performance, security, SEO, etc.
    {{ DiscussionBoard.errors[10124031].message }}

Trending Topics