Is my domain mapping negatively affecitng me for SEO? - dns

Consider this:
example.com is equivalent to domain.com/example
this is also true
example.com/subfolder is equivalent to example.com/example/subfolder
as a result of the domain mapping / .htaccess
is this bad?
to further elaborate, I am hosting multiple domains on the same ip

Search engines has the concept of duplicate content and that is exactly what will happen in your case.
If example.com/subfolder and example.com/example/subfolder have same content and is not marked as canonical of one another, then search engines considers them as duplicate. Your own page competes against each other, which will hurt the SEO values. In order to solve it, pick your preferred domain and do <linl rel=canonical href='your preferred domain' /> the other one to that.

Related

Wildcard subdomains with dnsmasq

I have a device that is already mapped to domain.tld. I now want to create a wildcard for all subdomains *.domain.tld so that they are mapped to the ip of domain.tld, too.
How do I do this with dnsmasq?
In the dnsmasq.conf file, add the line
address=/.domain.tld/192.168.0.1
But use the IP you actually want as that end bit
While the accepted answer may have solved the author's problem, it is misleading as it suggests that the leading dot would match subdomains only, which is not true.
dnsmasq ignores any leading dots, so that
address=/domain.tld/192.168.0.1
is equivalent to
address=/.domain.tld/192.168.0.1
or even
address=/......domain.tld/192.168.0.1
As of now (dnsmasq v2.76), there is unfortunately no way to specify some things (server, address, ipset) for
a single domain name only, i.e. domain name without its subdomains
only for the subdomains of a domain name
The only thing you can do, is to specify something for a domain name and all its subdomain and have override it for specific subdomains, e.g.
address=/domain.tld/192.168.0.1
address=/sub.domain.tld/10.10.0.1
This single domain name only case, may be tackled with different options, such as host-record, srv-record, which may be sufficient in some cases, but certainly not in all. It won't work for example, if you really need to use the server or ipset option for a single domain name only.

Sharethis different results for domain with and without www

I put sharethis on my site, and if I go to the site andrewwelch.info without the www, then the shares are different from if I go to www.andrewwelch.info. How can I make sure that this doesn't happen?
ShareThis is rendered inside an IFRAME, and will use the parent frame's URL to determine the page someone is sharing.
You can add span tags with a st_url attribute to specify a canonical URL to use for a given page. An example is:
<span class="st_sharethis" st_url="http://sharethis.com" st_title="Sharing is great!"></span>
See here for more details.
As a side note: To improve your search engine rankings you should ensure your site doesn't present two different versions of each page. Search engines may reduce the relevancy of your site in results if this is the case. For example, the content of the following pages (and every other page on your site) are the same:
http://andrewwelch.info/
http://www.andrewwelch.info/
You need to fix this by choosing whether you want the "www" or not, then using one of the following methods:
Use a "canonical" meta tag to tell search engines which page is the one you want indexed.
Respond to requests for the "www" or "non-www" hostname with a 301 redirect to the other.

Is it possible to redirect domain to a case sensitive version of itself?

Is it possible to do a DNS redirect so that mywebsite.com would remap to MyWebsite.com?
This would be for purely cosmetic purposes on the domain name alone. I understand that the domain name will ultimately resolve to a lower case version, and that all characters following the TLD are best kept in lowercase.
What I'd like to achieve is simply maintaining MyWebsite.com/whatever-in-lower-case in the URL bar.
DNS is not case-sensitive, so this is not likely to be possible. You can modify your bookmarks/home page links/embedded URLs/whatever to contain the case you want, though, but I'm not sure it's really worth the effort...

CakePHP nice urls - how to prevent normal urls from working

I have a website that's written using CakePHP. I've added some rewrite rules in the .htacces file to change the default urls to different ones (instead of /controller1/action1/parameter I have /some-string-about-controller-and-action/parameter, for example).
The problem is that now both the normal url and the nice one are available, and google seems to be indexing both, which is a problem. I'd like to only keep the nice one, which is the proper way to handle this so that it affects the google results as little as possible?
I don't know why you don't want to use cakes own routing (if you are having trouble doing what you want, you can accomplish what you want with a custom route class), then make sure that you redirect all relevant URL's in your .htaccess file to the desired URL using a MOVED PERMANENTLY redirect.
This way google will index the target url instead of the one that is undesirable. You are right to take offense to this, double indexing is a great way to harm your SEO rankings.

mod_rewrite complexity problem

I have a need to mod-rewrite my domain based off of subdomains...there are two scenarios in which i would need to do this:
my site is located in different cities...so losangeles.example.com should localized to los angeles, etc...essentially rewritten to www.example.com/?loc=losangeles
i want to allow users to create username.example.com to pass their profiles to friends with ease...essentially rewritten to www.example.com/user.php?id=username
As my site scales, I plan on having over 300 locations, and several thousand users...which means that hand coding each rewrite rule would be a little tedious.
How can I tell mod-rewrite to decipher between a location subdomain and a username subdomain?
I think fundamentally you need to rethink that strategy as mixing your namespaces is going to cause a lot of headaches in the long term. Consider what happens if you have missed out a city name, such as alexandra.example.com but a user has registered that username? Also, you are going to end up with having to do things like checking whether a city exists at the point that a username is trying to be created.
If you really do want to stick with this, one possibility is simply to send the requests to a single point which then does the lookup against your two databases and then internally sets a variable of either $city or $user .
Once you have set up your DNS wildcarding, in Apache set:
ServerAlias *.example.com
and then the rest of your virtualHost as normal.
Then in the application just check against $_SERVER['SERVER_NAME'], e.g.
$server_name = addslashes($_SERVER['SERVER_NAME']);
$query = "select * from instances where '{$server_name}' regexp replace(concat(server, '$'),'.','\.') limit 1";
but then you're actually going to have to have two queries and additional logic to pull apart the two namespaces or handle clash situations.
I would use a namespace like
<cityname>.example.com/user/<username>
which will avoid the problems, and also mean that you can customise what is visible on the user's homepage depending on which city you've entered, if that is desirable.

Resources