I am trying to get 301 redirect to work so that my old links in google at example.com/blog/... are 301'd to example2.com/blog/...
I have a .htaccess in my root directory and ofcourse the one in the serendipity directory (/blog). Which should I edit?
I currently have the following in my example.com/.htaccess
rewritecond %{http_host} ^www.example.com [nc]
rewriterule ^(.*)$ http://www.example2.com/$1 [r=301,nc]
rewritecond %{http_host} ^example.com [nc]
rewriterule ^(.*)$ http://www.example2.com/$1 [r=301,nc]
These are hosted on the same site. I simply changed my domainname. Everything works fine except my blog (including other subdirs) so I know it is because of the /blog/.htaccess.
Any help would be greatly appreciated.
Thanks,
Randy
301 from example.com/blog to example2.com/blog
Thanks for the reply.
Yes, I understand that is how it works. I should have provided more information.
I have the following added to the default serendipity .htaccess file:
RewriteCond %{http_host} ^www.example.com [nc]
RewriteRule ^(.*)$ http://www.example2.com/blog/$1 [r=301,nc]
It works ok when I go to example.com/blog (301's to www.example2.com/blog) but it doesn't work for www.example.com or direct links to something like:
http://example.com/blog/archives/2008/03.html
The error is:
Bad Request
Your browser sent a request that this server could not understand.
Additionally, a 400 Bad Request error was encountered while trying to use an ErrorDocument to handle the request.
However, http://example.com/blog/archives/2008/ works just fine.
When I go to www.example.com it goes to
http://www.example2.com/blog//home/dire ... 2.com/blog
In other words I only have it partially working. I don't understand the mod_rewrite stuff enough to figure this out what will work without messing up what serendipity is doing.
Yes, I understand that is how it works. I should have provided more information.
I have the following added to the default serendipity .htaccess file:
RewriteCond %{http_host} ^www.example.com [nc]
RewriteRule ^(.*)$ http://www.example2.com/blog/$1 [r=301,nc]
It works ok when I go to example.com/blog (301's to www.example2.com/blog) but it doesn't work for www.example.com or direct links to something like:
http://example.com/blog/archives/2008/03.html
The error is:
Bad Request
Your browser sent a request that this server could not understand.
Additionally, a 400 Bad Request error was encountered while trying to use an ErrorDocument to handle the request.
However, http://example.com/blog/archives/2008/ works just fine.
When I go to www.example.com it goes to
http://www.example2.com/blog//home/dire ... 2.com/blog
In other words I only have it partially working. I don't understand the mod_rewrite stuff enough to figure this out what will work without messing up what serendipity is doing.