Confused with the whole 301 redirect
Designing websites is not always as simple as people think it is. Especially when it comes to building them for SEO (search engine optimization).
Recently I’ve been moving a subdomain onto its own website and it’s been such a headache. Not only was I moving the entire section out, I was revising the content so it was fresh and up to date. For the past few weeks, I’ve had this confusing mind map in my head of how I would restructure the pages what to do with the old urls from the subdomains that are already indexed in the search engines.
If you do a search for advice on the proper ways to redirect url without losing your page ranking, you’ll find a number of theories on which approach is best. I honestly don’t know what’s the better solution. Some “experts” say 301 redirects are the better approach if you want to play nice with the search engines while others say 302 redirects which are the temporary redirects being the better choice.
Then one could theoretically place redirect coding within a page to send visitors to the new pages. But again these so called “experts” say that meta refresh codes are often seen as spam. Would a php redirect be a better solution?
After some time researching, I just had enough and said, ok 301 redirect it is. In cPanel, there’s a redirect tool in the domain section that basically helps you to redirect either 301 (permanent) or 302 (temporary) to the new pages by automatically writing to the .htaccess file. I’ve altered my .htaccess file before but people online always say to be careful with what you put in there. I wasn’t sure which of the coding I found online was the most appropriate for my hosting server so I just decided to use the tool in cPanel to do it for me.
Here’s where things got sticky for me.
I manage to redirect all my subdomain urls to their new respective pages on the new domain. I loaded up the old urls and everything flew over to the new urls without a hitch.
What was interesting was that redirecting /index.html to a new page didn’t automatically assume / is going to the new page. I didn’t test to see if just doing a redirect for / would be assumed for both domain.com/ and domain.com/index.html . No big deal, I just put in a redirect line for / along with /index.html and the problem was solved.
Then it got me thinking about the way websites are structured. In case you don’t know, subdomains are essentially subfolders within the main directory that you have specified to use a subdomain url instead of a subfolder url.
Subdomain URL: yoursubdomain.yourdomain.com
Subfolder URL: yourdomain.com/subfolder/
The content of that directory are the same things. subdomain files = subfolder files for the same name. So in reality, yoursubdomain#1.yourdomain.com/file#1.html is the same as calling it by the URL yourdomain.com/yoursubfolder#1/file#1.html The same page, two different addresses to bring it up by.
When I started thinking about it this way, I discovered that my same exact subfolder URLs were not being redirected. So I decided to put redirects for those urls to the new pages, thinking the same principle applies.
Unfortunately, it didn’t seem to work at all. Subdomains redirect fine but the subfolders are not and all my pages are called. At this point, I dunno if I should just delete these files already or whether that would hurt my page ranking and indexing for those pages….since they are of course tied to the subdomain URLs.
Then I noticed that cPanel created new .htaccess files for each of the subdomain folders and the redirects for them are housed there…while the subfolder redirects were housed at the main directory’s .htaccess file. I’m not sure if something is conflicting or if the main directory’s commands are being overridden by the subdomain’s .htaccess commands.
It’s really peculiar and continues to be a mystery. For now, I think I’ve wasted enough time trying to figure out why and how to fix it. I’ll just wait a few months til things settle down with the indexing and page ranking and aging of my new site before I pull the plug on those pages completely but keeping the 301 redirect prompts. Not sure what is the correct solution but I’m done. I’ve already spent all of last night making another attempt at rescuing a wordpress blog upgrade gone wrong from a couple of months ago. Luckily, it was a success this time!
If anyone knows what I’m doing wrong with the 301 redirects, please let me know! I don’t know a lot of stuff with designing but I know more than my peers so asking them for advice is like an exercise in the blind leading the blind. To all the super techies out there that are in the know, help me!!!!!!











