I have a domain that has over 80,000 indexed urls/webpages in Google. I want to redirect each one of those urls to a different domain and/or a sub-directory/page of that different domain. I am currently using this in .htaccess : redirect 301 / http://www.newdomain.com It works as a redirect for the old domain for "www" and without, but only for the main/home page: http://www.olddomain.com redirects to http://newdomain.com http://olddomain.com redirects to http://newdomain.com My question is: How do I get all the other 79,998 indexed urls pages to redirect to the new domain? I have tried using the "meta refresh" code in a 404 custom error page and it isn't working. I have also tried using the 301 redirect above for each and every individual page and it doesn't seem to work either. Anyone have any ideas? btw, here is an example of one of the urls: olddomain.com/mod.php?mod=calendar&op=month_view&date=20060820&side_month=1125558000 Thanks.
RewriteEngine on RewriteCond %{HTTP_HOST} ^www.olddomain.com RewriteRule ^(.*)$ http://www.newdomain.com/$1 [r=301,L] I'm actually using this to redirect my domain.NET and domain.ORG to domain.COM
Thanks for trying but that only works for the home page (www.mydomain.com), not any of the indexed urls.
and you have mod_rewrite installed? I've been using this for quite some time. Test it on http://www.comptrio.net/websiteoptimization.html?and=some&other=stuff and it will change the domain name to comptrio.com while still going to the same inside page I'm only using it for the tld extension (.com, .net), but it will also work for the domain itself
Yes it must be installed because it does work for redirecting olddomain.com to newdomain.com but it won't work for the messy urls I have indexed in Google. Here is what I am using right now: RewriteEngine on RewriteCond %{HTTP_HOST} ^www.olddomain.com RewriteRule ^(.*)$ http://www.newdomain.org/$1 [r=301,L] Could you tell me how to redirect to a sub-directory or sub-page? I am assuming that it would just be: RewriteRule ^(.*)$ http://www.newdomain.org/subpage.html$1 [r=301,L] instead of: RewriteRule ^(.*)$ http://www.newdomain.org/$1 [r=301,L]
^(.*)$ takes everything from after the domain name up to the last character of your URL and returns it in $1 Try dropping the RewriteCond %{HTTP_HOST} ^www.olddomain.com because you're redirecting ALL traffic from old to new, there may be no need to specify that this is conditional.
Still doesn't work I also checked that the ".txt" is NOT on the end of the .htaccess and the permissions are "644" btw, here are some example urls I'm trying to redirect: olddomaindotcom/mod.php?mod=calendar&op=month_view&date=20060524&side_month=1120201200 olddomaindotcom/mod.php?mod=calendar&op=view_day&date=20050415&side_month=1117609200 olddomaindotcom/mod.php?mod=calendar&op=view_day&date=20050813&side_month=1107162000
Are all 79,998 old URLs like... olddomaindotcom/mod.php?mod=calendar&op=month_view&date=20060524&side_month=1120201200 olddomaindotcom/mod.php?mod=calendar&op=view_day&date=20050415&side_month=1117609200 What are the new URLs like?
Yes, that is what all the urls are like. I want to redirect them to: newdomain.com/blahblah.html newdomain.com/morenonsense.html Thanks.
month_view olddomaindotcom/mod.php?mod=calendar&op=month_view&date=XXXXX&side_month=YYYYY to month/XXXXX/YYYYY.html view_day olddomaindotcom/mod.php?mod=calendar&op=view_day&date=XXXXX&side_month=YYYYY to day/XXXXX/YYYYY.html domain.com/.htaccess on old domain. Options +Indexes Options +FollowSymlinks RewriteEngine on RewriteBase / RewriteRule ^mod\.php?mod=calendar&op=month_view&date=([^.]+)&side_month=([^.]+)$ http://www.domain.com/month/$1/$2.html [R=301,L] RewriteRule ^mod\.php?mod=calendar&op=view_day&date=([^.]+)&side_month=([^.]+)$ http://www.domain.com/day/$1/$2.html [R=301,L] domain.com/.htaccess on new domain. Options +Indexes Options +FollowSymlinks RewriteEngine on RewriteBase / RewriteRule ^month/([^.]+)/([^.]+)\.html$ mod.php?mod=calendar&op=month_view&date=$1&side_month=$2 [L] RewriteRule ^day/([^.]+)/([^.]+)\.html$ mod.php?mod=calendar&op=view_day&date=$1&side_month=$2 [L]
Thanks a lot - much appreciated. How about if I just wanted to redirect all the urls to the same top level domain home page like: www.newdomain.com What would that look like?
Options +Indexes Options +FollowSymlinks RewriteEngine on RewriteBase / RewriteRule ^mod\.php?mod=calendar&op=month_view&date=([^.]+)&side_month=([^.]+)$ http://www.domain.com/ [R=301,L] RewriteRule ^mod\.php?mod=calendar&op=view_day&date=([^.]+)&side_month=([^.]+)$ http://www.domain.com/ [R=301,L] with no .htaccess needed on the new domain.
Still not working with OR without the "Options +Indexes Options +FollowSymlinks" It's really strange how when I upload the .htaccess file via FTP, it renames the file ".htaccess" to ".htaccess.txt" and then when I refresh the view window in the FTP client - the file disappears from view (but it is still residing in that directory). Of course, I am deleting the ".txt" part. Is it likely that my web host provider has the server configured to not accept certain types of calls in .htaccess? The code from my earlier post above seems to work, but only for the top level domain: www.mydomain.com and mydomain.com Very frustrating
try to slash before the ? in Nintendos code... This should get the regex to handle the URL correctly and may be why the main page worked, but not the dynamic URLs
I finally got it to redirect all of those 80k dynamic url's. This is the code that did it: Options +FollowSymlinks RewriteEngine On RewriteRule ^(.+)$ http://newdomain.com/ RedirectMatch permanent ^/$ http://newdomain.com/