Sam
Sam

Reputation: 4339

.htaccess rewrite issue on iPhone

I am trying to redirect (www and non-www).olddomain.com to www.newdomain.com, and newdomain.com to www.newdomain.com

Options +FollowSymlinks
RewriteEngine on


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

RewriteCond %{HTTP_HOST} ^newdomain.com$
RewriteRule (.*) http://www.newdomain.com/$1 [R=Permanent]

These rules appear to work for all browsers except for Safari on the iPhone - it works on the iPad. iPhone redirects to www.newdomain.com/http://www.newdomain.com/ when going to olddomain.com.

Upvotes: 1

Views: 595

Answers (1)

LazyOne
LazyOne

Reputation: 165373

Interesting ... Let's try be more specific/accurate. If this will not help -- please provide real domain names so I can look at actual http headers.

But before you are going to do this -- please clear your browser caches/restart (on iPhone) if possible -- modern browsers (at least desktop ones) do cache 301 redirects .. and if your initial rewrite rule went wrong, browser may still use that cached redirect.

Options +FollowSymlinks
RewriteEngine on

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

Final domain is the same for both rules, so I have joined them into single rule.

Upvotes: 1

Related Questions