Subdomain redirect when using HTTPS - apache

My website runs on WooCommerce in public_html. I have a Subdomain in a public_html/sub. When I try to access the sub using HTTPS it seems to redirect to /wp-admin. I'm using the default URL rewrites that come with WooCommerce. How can I fix this issue?

Look at the Apache Config / Vhosts etc.
Basically, search for *:443 in the configuration file (or [ipaddress]:443 if you have fixed IP addresses associated with your server).
This will explain the difference in behaviour.

Related

Cloudflare and cPanel issue - Reidrects back to main hostname

So I setup a subdomain off my regular domain. I then make an A record on Cloudflare to point to the IP address of my server. However, whenever I go to the subdomain, it just takes me back to the main hostname. (So i have sub.domain.com and when I go to sub.domain.com in my browser, it redirects me back to domain.com)
What could be the issue? I've checked .htaccess.
I've had similar issues with cPanel and Cloudflare before where cloudflare won't properly direct to the proper subdomain.
This is very difficult to look at without knowing the actual domain or subdomain in question. We don't do anything that would put a redirect in by default, so it sounds like it may be an issue on your server directly.

Apache 2.2 disable unconfigured subdomains

There is a webserver which has example.com, www.example.com, my.example.com, shop.example.com, static.example.com. All sites except www.example.com is on https. My problem is when I type randomstring.example.com -> shop.example.com gets served. But I want nothing to be served. For example mail.google.com is a valid subdomain. if you type johndoe.google.com you see "This webpage is not available". How to achieve this via Vhost/.htaccess file.
It's not the part of apache. You should disallow DNS resolving for subdomains like *.example.com.
or
If you don't have access to the DNS server - you can create a virtualhost with blank index page and put this virtualhost directive on top of the all virtualhosts. It shouldn't be same as google's behavior (they are using 1st way), but at least you can protect shop.example.com visiting from randomstring.example.com

How to disable default website for server when subdomain is not found?

I have multiple websites hosted on server using Webmin panel version 1.660
If I enter existing subdomain like www.domain2.com everything works fine, but for non-existing subdomains like wwwa.domain2.com server loads page from domain1.com
Is there any way to disable this feature?
I would like that non-existing subdomains would show 404 error or would be redirected to appropriate domain.
If you are using Apache, search Google for 404 redirects and url rewriting. Also if you want to take it future, then you also need to configure your DNS to catch all subdomains and redirect to your HTTP server

SSL 301 Redirect Errors- Joomla and Nginx

My website is www.survivorssupply.com. I want to use SSL for my entire site because when I use SSL on only certain portions, the SSL certificate says certain parts were not delivered securely, not everything is secure, etc.
When I go into the Joomla admin panel, I set the entire site to force SSL for everything. I then get an issue with an endless redirect loop (301 error). My site is running the latest version of Joomla 2.5 on Nginx.
Is there some kind of rewrite I can use or does anyone know any Joomla tricks?
You are probably missing an extra parameter in the 443-section of your Nginx configuration. Add "fastcgi_param HTTPS on;" to the fastcgi-section.
#alfasin, Nginx doesn't use files like httpd.conf or .htaccess
check your httpd.conf and .htaccess for 301 redirect rules regarding HTTPS
you receive the warning that parts of your site are not secured because you have embedded links which use HTTP instead of HTTPS - I would create a backup of teh site and start changing all the urls in the: template, articles, modules etc.

help regarding setting up pseudo/fake subdomains on apache

First of all, sorry if I got the term 'pseudo subdomain' wrong.
what I am trying to achieve is this-
When someone registers on my application, they get a new url like..
yourname.myapp.tld
I dont want to use the subdomain system for this. To be frank, I dont know how the subdomains exactly work but it guess it requires a folder per subdomain inside the document root and then the server redirects the requests there.
Can this be achieved by doing something like -
when a visiter types any subdomain, (anything.myapp.tld), he is able to access myapp . In the index.php file i will explode the $_SERVER['HTTP_HOST'] to get the subdomain which i will store in session and will thereafter act as an identifier for that user. Ideally i wouldnt want to create any vhosts or add many lines to the hosts file. Can this be achieved with just one vhost?
Is this possible with mod rewrite or something ?
Yes you can archive this using wildcard that needs to be configured on both, the dns server and http server
On the dns a entry like this (installing dns on ubuntu https://help.ubuntu.com/10.04/serverguide/C/dns.html):
; wildcard subdomains are all directed to this IP
; of course this should be the IP of your web server
*.domain.tld. IN A 1.2.3.4
At apache an entry like this:
<VirtualHost 111.22.33.55>
DocumentRoot /www/subdomain
ServerName www.domain.tld
ServerAlias *.domain.tld
</VirtualHost>
What happens after is that everything.domain.tld will be going to your main folder so you can use the index.php to redirect it to the right place or even an htaccess using mod_rewrite.