Forum Moderators: phranque
Options +FollowSymlinks
DirectoryIndex index.html index.htm index.php
RewriteEngine on
RewriteBase /
#RewriteRule !redirect.html /redirect.html
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_HOST} ^(.*)example\.net [NC]
RewriteRule (.*) http://%1example.org%{REQUEST_URI} [R=301,L] [edited by: phranque at 10:23 pm (utc) on Sep 14, 2013]
[edit reason] unlinked url [/edit]
[NC] in the HTTP_HOST is unnecessary -- Browsers automatically correct it to lower case prior to sending the request even if someone types in all caps.
The first condition says if the referrer is not empty -- That means any type-in, bookmark clicks or search engine will not be redirected.
Would it work better if I did an .htaccess file in each subdomain
there are 23 subdomains, which are listed in the NEW domain .htaccess
Would it work better if I did an .htaccess file in each subdomain...
[edited by: JD_Toims at 8:49 pm (utc) on Sep 14, 2013]
RewriteEngine on
#RewriteRule !redirect.html /redirect.html
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_HOST} ^(.*\.)?old\.net [NC]
RewriteRule ^(.*)$ http://%1new/$1 [R=301,L]
RewriteCond %{HTTP_REFERER} !^http://www2.old.net/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www2.old.net$ [NC]
Options +FollowSymlinks
DirectoryIndex index.html index.htm index.php
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^([^.]+\.)?old\.net
RewriteRule .? http://%1new.org%{REQUEST_URI} [R=301,L] [edited by: phranque at 10:24 pm (utc) on Sep 14, 2013]
[edit reason] unlinked urls [/edit]
Different domain names, as the old one is no longer in my control...
What I WANT it to is to redirect where if a person types in one path (i.e. old.net/xyz.php) it goes to the new domain instead, to new.org/xyz.php
I've cleared cache on FF, IE, Chrome, Maxthon, and Safari. I'll try again, restart the machine again, and see what happens.
HTTP/1.1 200 OK
Date: Sat, 14 Sep 2013 23:54:09 GMT
Server: Apache
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: PHPSESSID=ilo6apm2knhbfov21m0kq1n6q4; path=/
Vary: Host,Accept-Encoding,User-Agent
Connection: close
Content-Type: text/html
HTTP/1.1 200 OK
Date: Sun, 15 Sep 2013 00:38:53 GMT
Server: Apache
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: PHPSESSID=ntd4aochntoga2o6ajeik0no31; path=/
Vary: Host,Accept-Encoding,User-Agent
Connection: close
Content-Type: text/html