7 added 3 characters in body
source | link

I guess you should not enclose your new.com with quotes "", neither scape it because your regular expression is inside RewriteCond, not inside the target.

Try something like this:

Options +FollowSymlinks
RewriteEngine on 


RewriteCond %{HTTP_HOST} ^old\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.old\.com$
RewriteRule ^some\-page\.php$ http://www.new.com/some-other-page.php [R=301,L]

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

Edit: I've added specific url redirection.

As you can see, order matters, is you have something specific you should place it upfront other rules that are more generic like host redirection.

If you need to play a little bit with htaccess you should use a tester like this. You have to enter urls like http://www.old.com/somepage.php, or http://www.old.com, always using http://.

I guess you should not enclose your new.com with quotes "", neither scape it because your regular expression is inside RewriteCond, not inside the target.

Try something like this:

Options +FollowSymlinks
RewriteEngine on

RewriteRule ^some\-page\.php$ http://www.new.com/some-other-page.php [R=301,L]

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

Edit: I've added specific url redirection.

As you can see, order matters, is you have something specific you should place it upfront other rules that are more generic like host redirection.

If you need to play a little bit with htaccess you should use a tester like this. You have to enter urls like http://www.old.com/somepage.php, or http://www.old.com, always using http://.

I guess you should not enclose your new.com with quotes "", neither scape it because your regular expression is inside RewriteCond, not inside the target.

Try something like this:

Options +FollowSymlinks
RewriteEngine on 


RewriteCond %{HTTP_HOST} ^old\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.old\.com$
RewriteRule ^some\-page\.php$ http://www.new.com/some-other-page.php [R=301,L]
RewriteRule ^(.*)$ http://www.new.com/$1 [R=301,L]

Edit: I've added specific url redirection.

As you can see, order matters, is you have something specific you should place it upfront other rules that are more generic like host redirection.

If you need to play a little bit with htaccess you should use a tester like this. You have to enter urls like http://www.old.com/somepage.php, or http://www.old.com, always using http://.

6 Corrected code example, thanks to w3d comment
source | link

I guess you should not enclose your new.com with quotes "", neither scape it because your regular expression is inside RewriteCond, not inside the target.

Try something like this:

Options +FollowSymlinks
RewriteEngine on

RewriteCond %{HTTP_HOST} ^old\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.old\.com$
RewriteRule ^some\-page\.php$ http://www.new.com/some-other-page.php [R=301,L]

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

Edit: I've added specific url redirection.

As you can see, order matters, is you have something specific you should place it upfront other rules that are more generic like host redirection.

If you need to play a little bit with htaccess you should use a tester like this. You have to enter urls like http://www.old.com/somepage.php, or http://www.old.com, always using http://.

I guess you should not enclose your new.com with quotes "", neither scape it because your regular expression is inside RewriteCond, not inside the target.

Try something like this:

Options +FollowSymlinks
RewriteEngine on

RewriteCond %{HTTP_HOST} ^old\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.old\.com$
RewriteRule ^some\-page\.php$ http://www.new.com/some-other-page.php [R=301,L]
RewriteRule ^(.*)$ http://www.new.com/$1 [R=301,L]

Edit: I've added specific url redirection.

As you can see, order matters, is you have something specific you should place it upfront other rules that are more generic like host redirection.

If you need to play a little bit with htaccess you should use a tester like this. You have to enter urls like http://www.old.com/somepage.php, or http://www.old.com, always using http://.

I guess you should not enclose your new.com with quotes "", neither scape it because your regular expression is inside RewriteCond, not inside the target.

Try something like this:

Options +FollowSymlinks
RewriteEngine on

RewriteRule ^some\-page\.php$ http://www.new.com/some-other-page.php [R=301,L]

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

Edit: I've added specific url redirection.

As you can see, order matters, is you have something specific you should place it upfront other rules that are more generic like host redirection.

If you need to play a little bit with htaccess you should use a tester like this. You have to enter urls like http://www.old.com/somepage.php, or http://www.old.com, always using http://.

5 deleted 1 character in body
source | link

I guess you should not enclose your new.com with quotes "", neither scape it because your regular expression is inside RewriteCond, not inside RewriteRulethe target.

Try something like this:

Options +FollowSymlinks
RewriteEngine on

RewriteCond %{HTTP_HOST} ^old\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.old\.com$
RewriteRule ^some\-page\.php$ http://www.new.com/some-other-page.php [R=301,L]
RewriteRule ^(.*)$ http://www.new.com/$1 [R=301,L]

Edit: I've added specific url redirection.

As you can see, order matters, is you have something specific you should place it upfront other rules that are more generic like host redirection.

If you need to play a little bit with htaccess you should use a tester like this. You have to enter urls like http://www.old.com/somepage.php, or http://www.old.com, always using http://.

I guess you should not enclose your new.com with quotes "", neither scape it because your regular expression is inside RewriteCond, not inside RewriteRule.

Try something like this:

Options +FollowSymlinks
RewriteEngine on

RewriteCond %{HTTP_HOST} ^old\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.old\.com$
RewriteRule ^some\-page\.php$ http://www.new.com/some-other-page.php [R=301,L]
RewriteRule ^(.*)$ http://www.new.com/$1 [R=301,L]

Edit: I've added specific url redirection.

As you can see, order matters, is you have something specific you should place it upfront other rules that are more generic like host redirection.

If you need to play a little bit with htaccess you should use a tester like this. You have to enter urls like http://www.old.com/somepage.php, or http://www.old.com, always using http://.

I guess you should not enclose your new.com with quotes "", neither scape it because your regular expression is inside RewriteCond, not inside the target.

Try something like this:

Options +FollowSymlinks
RewriteEngine on

RewriteCond %{HTTP_HOST} ^old\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.old\.com$
RewriteRule ^some\-page\.php$ http://www.new.com/some-other-page.php [R=301,L]
RewriteRule ^(.*)$ http://www.new.com/$1 [R=301,L]

Edit: I've added specific url redirection.

As you can see, order matters, is you have something specific you should place it upfront other rules that are more generic like host redirection.

If you need to play a little bit with htaccess you should use a tester like this. You have to enter urls like http://www.old.com/somepage.php, or http://www.old.com, always using http://.

4 added 150 characters in body
source | link
3 Corrected code example
source | link
2 corrected grammar
source | link
1
source | link