Moving from directory structure to subdomain URL structure

I have a website (powered by Rails/Postgres and nginx) where I had setup a blog and a coupons section as:

http://myrailsapp.com/blog/

http://myrailsapp.com/coupons/

Blog is powered by wordpress and similarly the coupons section is powered by PHP/Mysql.

The traffic of my website has increased a lot over the last 6 months. So, the thought was to move Blog and coupons on a different linode and hence i dont need to run mysql/php etc where my rails app is running, reducing my memory footprint as much as I can. So I am planning to move to subdomain structure from the existing subdirectory structure.

1) Is the above thought process correct?

2) How much SEO impact would I have, if I move from subdirectory to subdomain and set up 301 redirects. My subdirectory structure for coupons is indexed quite well in Google.. So any mistake here could be costly :(

3) I am not an expert on Nginx, so I ended up writing whatever I could:

location ^~ /coupons/ {

rewrite ^/coupons(.*) http://coupons.myrailsapp.com$1 permanent;

}

Would that set up 301 redirects correctly? Is there something else that I am missing here? Or is that all about it? Anything else in the above code that I must take care as far as SEO also goes..

Thanks

4 Replies

@jimishjoban:

The traffic of my website has increased a lot over the last 6 months. So, the thought was to move Blog and coupons on a different linode and hence i dont need to run mysql/php etc where my rails app is running, reducing my memory footprint as much as I can. So I am planning to move to subdomain structure from the existing subdirectory structure.

1) Is the above thought process correct?
Why don't you just upgrade your linode? It's much easier than managing two linodes.

@jimishjoban:

2) How much SEO impact would I have, if I move from subdirectory to subdomain and set up 301 redirects. My subdirectory structure for coupons is indexed quite well in Google.. So any mistake here could be costly :(
If the 301 is done properly, your new addresses will begin to appear in Google over time with more or less the same page rank. Or at least that's what Google says will happen, according to stuff I read elsewhere. People used to abuse subdomains for SEO, but nowadays Google probably knows how to distinguish the dirty tricks from legitimate moves.

@jimishjoban:

location ^~ /coupons/ {

rewrite ^/coupons(.*) http://coupons.myrailsapp.com$1 permanent;

}
Looks about right. I'd prefer to put a dollar sign at the end of the rewrite regex to mark the end (but it might be optional). You can also probably replace "location ^~ /coupons/" with "location /coupons" for a minor performance gain, because you don't really need a regex there.

Thanks for such a quick reply.

@hybinet:

Why don't you just upgrade your linode? It's much easier than managing two linodes.

I already upgraded to Linode 1536 recently. There are some good optimization techniques that I am trying to do (slowly and steadily) that should help more as far as Rails app goes. What I find worrying, is running Rails, PHP, Mysql, postgres, memcached, sphinx all on the same server.

The php/mysql stuff is only for blog and coupons.. so I was thinking if i dont run php and mysql, I maybe able to lower down my RAM usage and reduce memory swapping (that does happen on very heavy loads at 11 am in the morning)

Is my thinking correct? Or not running mysql/php not help much?

@hybinet:

If the 301 is done properly, your new addresses will begin to appear in Google over time with more or less the same page rank. Or at least that's what Google says will happen, according to stuff I read elsewhere. People used to abuse subdomains for SEO, but nowadays Google probably knows how to distinguish the dirty tricks from legitimate moves.

Looks about right. I'd prefer to put a dollar sign at the end of the rewrite regex to mark the end (but it might be optional). You can also probably replace "location ^~ /coupons/" with "location /coupons" for a minor performance gain, because you don't really need a regex there.

Thanks. So atleast the SEO part does not look as worrying as it seems.. or so I would hope.. :)

@jimishjoban:

The php/mysql stuff is only for blog and coupons.. so I was thinking if i dont run php and mysql, I maybe able to lower down my RAM usage and reduce memory swapping (that does happen on very heavy loads at 11 am in the morning)

Is my thinking correct? Or not running mysql/php not help much?

If you're swapping, your server is misconfigured, period.

Is your WordPress blog running on the same nginx server? Try reducing the number of FastCGI child processes, so that your server doesn't go into swap even with the heaviest load. (If it's Apache, reduce MaxClients for the same effect.)

Also make sure that you have APC installed, as well as a good caching plugin for WordPress. Even the smallest linode can handle dozens of WordPress pages per second if it is properly configured.

@hybinet:

If you're swapping, your server is misconfigured, period.

Is your WordPress blog running on the same nginx server? Try reducing the number of FastCGI child processes, so that your server doesn't go into swap even with the heaviest load. (If it's Apache, reduce MaxClients for the same effect.)

Also make sure that you have APC installed, as well as a good caching plugin for WordPress. Even the smallest linode can handle dozens of WordPress pages per second if it is properly configured.

Hmm… So, Let me give you a quick traffic background for my website:

Around 90,000 pageviews daily.

Around 9000 (or 10%) goes to coupons section daily (Powered by PHP/mysql)

Around 1000 to blog (Wordpress)

So there is not much traffic to blog and coupons, but the rest of the website (RoR application) gets the majority chunk. All 3 (RoR app, blog and coupons) are hosted on the same linode right now.

Do you still think it could be simply server misconfiguration? I am looking into that front too…

Thanks

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct