: Subdomain with dot? I'm not even sure how to search for an answer to this question, so my apologies if already asked. We have a subdomain setup on the server in the format eg.example.com.
I'm not even sure how to search for an answer to this question, so my apologies if already asked.
We have a subdomain setup on the server in the format eg.example.com. Some people are typing in eg.example.com. Is there a way of handling the pseudo-subdomain? If so, how?
More posts by @Sims2060225
4 Comments
Sorted by latest first Latest Oldest Best
Every domain will be acessible by
www.example.com and example.com
as
www.subdomain.example.com and subdomain.example.com
Including any subdomain, to solve this problem you just need do a 301 redirect to force your visitors to acess only. This will be good for your SEO and google ranking because your page rank is shared by prefix and non-www
For example:
10 strongly ranked sites links the page: example.com/page.html 5 strongly ranked sites links the page: example.com/page.html
Your pagerank points will be shared to 2 "differents" websites
How to solve, the best simple way:
Create a .htacess (or edit if you already have)
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www. [nocase]
RewriteRule .* eg.example.com%{REQUEST_URI}%{QUERY_STRING} [redirect=301,L]
Here is the solution:
open page on your domain folder
wp-adminnetworksite-new.php
replace
if ( preg_match( '|^([a-zA-Z0-9-])+$|', $blog['domain'] ) )
with
if ( preg_match( '|^([a-zA-Z0-9.-])+$|', $blog['domain'] ) )
I think you need a redirect in your .htaccess file (assuming you are using Apache server) to redirect from eg.example.com to eg.example.com
Use a 301 redirect. It will look like this:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www. [nocase]
RewriteRule .* eg.example.com%{REQUEST_URI}%{QUERY_STRING} [redirect=301,L]
The first line turns on the next following rewrite lines.
The second line tests for host names that begin with 'www.' (and is case insensitive), e.g. will find both 'www' and 'WWW' and 'Www'
The third line is the business line. If line 2 tests true, line 3 executes. It rewrites the URL that your user sent. It issues a redirect 301, which is permanent. And it exits, because of the 'L'. It also keeps any path and query intact (assuming that is what you want). The user's browser gets this redirect, as well as Google, DuckDuckGo, etc. And the user will see the line they typed changed into the correct URL.
The subdomain is nothing else than a DNS record applied to the root domain. If you consider the root domain example.com, any of the following is a valid subdomain
example.com foo.example.com
foo.bar.example.com
and even
*.example.com
*.foo.example.com
Then way you create subdomains is creating a DNS record for them, regardless it's a single-level subdomain (foo.example.com) or multilevel subdomain (foo.bar.example.com).
You need to check if the DNS provider your domain is using (it can be either a specific DNS provider or your current registrar) offers you to create subdomains and if they allow multiple levels.
If not, you can switch to a DNS hosting service that offers you more advanced DNS features. Keep in mind that you don't necessarily need to change web hosting or registrar, you can easily point the name server to another DNS provider without transferring the domain.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.