I have my domain in Godaddy and only one web application is hosted in AWS Server with ASP.NET MVC Framework.
Consider my scenario :
for ex: https://www.lakshmicaddy.com
User xyz is registering as new user in my website, then they need to get url as xyz.lakshmicaddy.com
2.User abc is registering as new user in my website, then they need to get url as abc.lakshmicaddy.com
Here I want to create a subdomain through programming in MVC and want to make let them point to the same www.lakshmicaddy.com application through https://xyz.lakshmicaddy.com and abc.lakshmicaddy.com
Question:
1.How can we create godaddy subdomain through ASP.NET MVC?
2.How can I link the subdomain with AWS application?
GoDaddy may have an API you can use to automatically create subdomains and update your domain's DNS records - however, this would be problematic, as DNS record updates can take some time to propagate (24 - 48 hours, depending on the host).
A better solution might be to update a .htaccess file that gives the illusion of a subdomain for each of your users.
For example - you might have your application create a folder called /users/user1 (url would be lakshmicaddy.com/users/user1). Your .htaccess file would map this file path to something like user1.lakshmicaddy.com
Your .htaccess file might look something like this:
RewriteEngine on
RewriteCond %{HTTP_HOST} subdomain.example.com$
# Your application would add new entries similar to below:
RewriteCond %{REQUEST_URI} !^/subdomains/user1
RewriteRule ^(.*)$ /users/user1/$1 [L]
Depending on how your application has been set up - you might consider saving the user's subdomain in a database table, along with their other credentials. However - this would be entirely optional.
More information can be found here:
.htaccess rewrite subdomain to directory
.htaccess - Redirect subdomain to folder
Fake Subdomain with mod-rewrite
I got a solution atlast.
I have created wildcard redirection like *.lakshmicaddy.com in binding and as well as A Name records in DNS Settings.
Then It is solved.
Related
For my ASP.NET MVC website, I want to allow access to a certain page, only if the user comes from a link on another certain page (that page could be from completely different URL).
Example:
I want to allow a user access to www.MySite.com/thispage, only if they come from a link on www.MySite.com/thatpage or www.MyOtherSite.com/thatpage
How can this be accomplished?
You'll want to check the HTTP_REFERER header
You can do that with
Request.UrlReferrer
That said, this isn't real security. Someone could set the referer header of their browser manually.
If this is just a means of preventing hotlinking, it's fine. But if you're only using this to keep people out of private/secure information, you'll want to implement some real form of authentication/authorization.
You can restrict it with the Referer however this can easily be manipulated so if this is very important to you... I would go another route.
What you can do is use .htaccess to prevent the incoming referring link from reaching your site. You could deny the incoming traffic from the site or link in question completely. Or, maybe you simply redirect or forward the incoming traffic from the site or link to somewhere else.
This can be applied to any web site with .htaccess as long as your host has mod_rewrite enabled.
If you are using Dolphin and it is installed in your root/main/http docs/public_html directory then you would add to:
yoursite()com/.htaccess
If you are using Dolphin and it is installed in a subfolder/subdirectory then you would add to:
yoursite()com/dolphin-directory/.htaccess
Add to .htaccess file after the line RewriteEngine on like:
RewriteEngine on
RewriteCond %{HTTP_REFERER} baddomain.com [NC]
RewriteRule .* - [F]
To forward or redirect traffic from the unwanted site or link to somewhere else then add:
RewriteEngine on
RewriteCond %{HTTP_REFERER} baddomain.com [NC]
RewriteRule .* http://en.wikipedia.org/ [R,L]
Note:
-Change RewriteCond line: baddomain.com to the link or site you want to prevent.
-Change RewriteRule line: http://en.wikipedia.org/ to the link or site you would like to redirect or forward it to.
--Be sure to download and backup your original .htaccess file prior to editing it. Htaccess is extremely sensitive and needs to be exactly right, or it can make your entire site error out.
---And be sure you test afterward to ensure everything is working properly. You do not want to accidentally block all traffic to your site.
You could always track what sites they visit like the big agencies do thus block them if they aren't coming from your utopia :)
I'm running WordPress MultiUser and a plugin to allow for domain mapping.
I have a subdomain site subdomain.domain.com
and I want domain2.com to point to it.
My tech buddy double checked my WP settings and said everything was good there.
When I go to my existing subdomain.domain.com site I am now redirected to domain.com registration page.
When I go to domain2.com I get the following:
The page isn't redirecting properly
Firefox has detected that the server is redirecting the request for this address in a way that will never complete.
Prior to the domain mapping attempt the sub.domain.com site worked fine
with sub.domain.com defined in Plesk as an alias of domain.com
I have domain2.com refined in Plesk as an alias of domain.com
I was told to have domain2.com made into an alias of sub.domain.com
but I don't see how to do that in Plesk.
Cloudflare is redirecting the domain2.com to the server correctly.
What am I missing?
It is probably best to contact CloudFlare so we can actually look at the zone file & then check any redirect rules on your server.
Just a quick note that mapped domains need to be added as individual domains, if not a subdomain of root domain, so that's why it is important for us to look at the zone file. If you're simply adding subdomains to a domain already added, then that is a different issue (WPMU plugin is also available through outside developer that only works for subdomains).
I have a web site with .htacess file looks like this:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^wendabang.com$ [NC]
RewriteCond %{HTTP_HOST} !^www.wendabang.com$ [NC]
RewriteRule ^(.*)$ http://www.wendabang.com/$1 [L,R=301]
This morning when I was checking Google web master tool I fond in the back link section Google listed wendabang.com as a site has links back to www.wendabang.com site.
I think this issue should be rested in my .htacess file. But I can not spot the issue.
Another shameless question what I should do if I want to redirect http://www.wendabang.com/ and www.wendabang.com to wendabang.com, I think ditching http:// and www is nice.
Thank you in advance.
the site has multiple issues
the http://www.wendebang.com/ redirects HTTP 302 temp. redirect to http://wendebang.com/. a HTTP 302 comunicate the start url to google as the right url. this means you tell google to see http://www.wendebang.com/ as the url it should display to its users.
additionally, inside your HTML you have
<link rel="canonical" href="http://www.wendabang.com">
and your links look like this
<a href="http://www.wendabang.com/web-analytics-beautiful-shortcomings.html"
as the canonical tag is treated by google like an HTTP 301 permanent redirect you are google again redirecting to the www version.
and a lot of the links point to the www version as well.
at this stage i believe it is a only due to google magnificent error handling that your site is still indexed by google.
1) please see this answer to see about the right way to da an www to non www redirect via .htaccess. Generic htaccess redirect www to non-www
2) change your canonical tags to non www urls
3) change your internal links to non www urls.
and http is a protocol, you can not ditch it (said that, you could ditch is and invent your own protocol on top of the tcp/ip layer, but that is probably not what you want)
I want to redirect http://abc.example.com to other external site abc.blog.com but i dont want to change the url from which i redirected. It should remain the same, i tried using dns but not working.
Kindly guide me with each and every step.
If its possible with htacces then how ?
If you own abc.example.com you can set it up as a CNAME of abc.blog.com, which you'd need to configure with your domain name registrar. A CNAME makes a domain the alias of another (without redirecting), which is the functionality you're after.
You may need to configure the abc.blog.com website to accept abc.example.com as a valid host (most blogging providers like blogger support this). My blog (via my SO profile) is an example of this.
You'll need to do a proxy redirect:
RewriteEngine On
RewriteRule ^.*$ http://someotherhost.tld/$0 [P]
When people access my app on www.example.com and log in, they get a cookie. I'm using the cookie option to store session on Rails. Accessing example.com (without the www), they must log in again, because Firefox does not recognize the previous session.
So, what do you think is the best way to avoid this?
I guess I will use a small .htaccess rule (Apache + Passenger) like this:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example\.com
RewriteRule ^(.*)$ http://www.example.com/$1 [R=permanent,L]
Do you guys think that is a good solution?
What I would do is:
Set up separate virtual hosts for domain.com and www.domain.com
Never publish links to domain.com, only to www.domain.com
When a user agent requests http://domain.com/, redirect with a 301 response to http://www.domain.com/
Only issue cookies from www.domain.com
Don't try to make the whole site available from domain.com, just the main page (which is redirected)
You don't need to involve rails in this solution at all.
Create separate virtual host entry:
ServerName domain.com
Redirect permanent / http://www.domain.com
The redirect points the user to your other virtual host:
ServerName www.domain.com