webgyrl Posted May 25, 2009 Share Posted May 25, 2009 Hi! Just took down an old site that had a bunch of subdomains and created a new site with everything on one domain. I'm having some trouble with my .htaccess redirect. I thought that if I used this it would work: ##Re-Directs Begin Redirect 301 /web-design/myspace-custom-profiles.html http://www.example.com/ Redirect 301 /web-design/myspace -custom-profiles.html http://www.example.com/ Redirect 301 http://myspace.example.com http://www.example.com/ Redirect 301 http://graphics.example.com http://www.example.com/ Redirect 301 http://retouch.example.com http://www.example.com/ Redirect 301 http://webdesign.example.com http://www.example.com/ Redirect 302 /web-design/myspace -custom-profiles.html http://www.example.com Redirect 301 /web-site-design/5-ways-to-save-money-when-working-with-a-graphic-designer.html http://www.example.com/helpful-info/77-5-w...-a-web-designer Redirect 301 http://graphics.example.com/content/view/139/113/ http://example.com/helpful-info/77-5-ways-...-a-web-designer ##Re-Directs End With this I am getting internal server errors. So I googled a bit and came up with this post: http://www.webweaver.nu/html-tips/web-redirection.shtml And I tried this: Redirect 301 / http://www.example.com/ But when I do this and try the old URLs I get this: Redirect Loop Firefox has detected that the server is redirecting the request for this address in a way that will never complete. The browser has stopped trying to retrieve the requested item. The site is redirecting the request in a way that will never complete. * Have you disabled or blocked cookies required by this site? * NOTE: If accepting the site's cookies does not resolve the problem, it is likely a server configuration issue and not your computer. Any idea how I can properly redirect the old links to the main domain now that everything lives there? Thanks! Quote Link to comment Share on other sites More sharing options...
OJB Posted May 25, 2009 Share Posted May 25, 2009 You will possibly be getting an internal server error because your redirects cannot have spaces in them e.g. Redirect 301 /web-design/myspace -custom-profiles.html http://www.example.com/ this has a space in between /web-design/myspace and -custom-profiles.html thats my guess anyway Quote Link to comment Share on other sites More sharing options...
webgyrl Posted May 29, 2009 Author Share Posted May 29, 2009 Hi OJB! Thanks for that suggestion. I did try it with a little luck, no internal server errors. Here are the actual redirects ##Re-Directs Begin Redirect 301 /web-design/myspace-custom-profiles.html h##p://www.mbstia.com/ Redirect 301 h##://myspace.mbstia.com h##p://www.mbstia.com/ Redirect 301 h##p://graphics.mbstia.com h##p://www.mbstia.com/ Redirect 301 h##p://retouch.mbstia.com h##p://www.mbstia.com/ Redirect 301 h##p://webdesign.mbstia.com h##p://www.mbstia.com/ Redirect 301 /web-site-design/5-ways-to-save-money-when-working-with-a-graphic-designer.html h##p://www.mbstia.com/helpful-info/77-5-ways-to-save-money-when-working-with-a-web-designer Redirect 301 h##p://graphics.mbstia.com/content/view/139/113/ h##p://mbstia.com/helpful-info/77-5-ways-to-save-money-when-working-with-a-web-designer ##Re-Directs End For most links I get an error 404 For the last one, I get this: Not Found The requested URL /content/view/139/113/ was not found on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. For the ones that were the subdomains are pointing me to a page that says: Great Success ! Apache is working on your cPanel® and WHM™ Server I went into cPanel and deleted the subdomains. The redirects are not working at all. I am really not sure why this would be. I thought I wrote them correctly? Any insight would be awesome. Quote Link to comment Share on other sites More sharing options...
OJB Posted May 29, 2009 Share Posted May 29, 2009 (edited) I am not sure you can use REDIRECT 301 with an entire subdomain in the way you have... I think to do a subdomain you have to do this: >RewriteCond %{HTTP_HOST} ^myspace\.mbstia\.com RewriteCond %{HTTP_HOST} ^graphics\.mbstia\.com RewriteCond %{HTTP_HOST} ^retouch\.mbstia\.com RewriteCond %{HTTP_HOST} ^webdesign\.mbstia\.com RewriteRule ^(.*)$ http://mbstia.com/$1 [L,R=301] Edited May 29, 2009 by OJB Quote Link to comment Share on other sites More sharing options...
webgyrl Posted May 29, 2009 Author Share Posted May 29, 2009 Hi OJB, Ok a little progress. I took out the subdomain redirects and the other redirects are working, except: h##p://graphics.mbstia.com/content/view/139/113/ h##p://mbstia.com/helpful-info/77-5-ways-to-save-money-when-working-with-a-web-designer Obviously it is because this has the subdomain address configurations, so not sure how to fix that. Unfortunately, this is not working to re-direct the subdomains: ##Subdomain Re-Directs Begin RewriteCond %{HTTP_HOST} ^myspace\.mbstia\.com RewriteCond %{HTTP_HOST} ^graphics\.mbstia\.com RewriteCond %{HTTP_HOST} ^retouch\.mbstia\.com RewriteCond %{HTTP_HOST} ^webdesign\.mbstia\.com RewriteRule ^(.*)$ h##p://mbstia.com/$1 [L,R=301] ##Re-Directs End I am getting a "Cannot Find Server" error with this in place. I did see in cPanel a way to put back in the subdomain and do a re-direct there. Would that be a wiser route to take than doing this in .htaccess? Thank you so much for your help! Quote Link to comment Share on other sites More sharing options...
click Posted May 30, 2009 Share Posted May 30, 2009 (edited) You are getting the server not found message because you removed the subdomains in cPanel. Without the subdomains set up, there is no DNS entry for the subdomain and the request never reaches the server. You need to recreate the subdomains in cPanel and either use the redirects OJB gave you in .htaccess or just go ahead and let cPanel handle it for you. That last redirect could be handled in .htaccess with: >RewriteCond %{HTTP_HOST} ^graphics\.mbstia\.com RewriteRule ^content/view/139/113/$ http://mbstia.com/helpful-info/77-5-ways-to-save-money-when-working-with-a-web-designer [L,R=301] Edited May 30, 2009 by click Quote Link to comment Share on other sites More sharing options...
webgyrl Posted May 30, 2009 Author Share Posted May 30, 2009 Hi click! Ok I re-added the subdomains back in and did the re-direction to the main domain that way. Everything works perfectly now! Thank you for all the help and for teaching me some new things!!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.