RewriteEngine redirects to subdomain instead of Rewriting
- Recently switched to Jupiter theme -> this caused the Alias menu to disappear.
- I have `mydomain.abc` as my primary domain (there's no way to change the directory of a primary domain but I don't want my http files to reside in /home/***/public_html)
- I'd like to use it as an alias to show my subdomain xyz.mydomain.abc (this is in /home/***/public_html/apps/xyz)
- The only option I found to do this is by using .htaccess that uses RewriteEngine
- The RewriteEngine doesn't do its job. Instead of loading the page mydomain.abc, it redirects to the url xyz.mydomain.abc. I don't want this behavior, I want no redirect but I want to show xyz.mydomain.abc while accessing mydomain.abc in the browser's url.
- If the .htaccess is present, an entry in the Redirects page (https://cpanel:port/session/frontend/jupiter/mime/redirect.html) is created and when I attempt to delete it, it says successful but upon checking the redirect rule is still there (maybe because the .htaccess is still present that's why the entry persists)
How do I go about this?
My domain and hosting are both from GoDaddy.
Here is my .htaccess
RewriteEngine on
RewriteCond %{HTTP_HOST} ^mydomain\.abc$ [OR]
RewriteCond %{HTTP_HOST} ^www\.mydomain\.abc$
RewriteRule (.*) "https://xyz.mydomain.abc/$1" [NC,L]
-
I understand that you're facing issues with the alias menu disappearing after switching to the Jupiter theme. Additionally, you want to configure an alias to display a subdomain without redirection. Here's a revised explanation:
To resolve this, you may need to modify the
.htaccess
file to achieve the desired behavior without redirection. This modification should display the content ofxyz.mydomain.abc
when accessingmydomain.abc
without triggering a redirection.
Here's an adjusted version:RewriteEngine on
RewriteCond %{HTTP_HOST} ^mydomain\.abc$ [OR]
RewriteCond %{HTTP_HOST} ^www\.mydomain\.abc$
RewriteRule ^$ /apps/xyz/index.html [L]1 -
MilesWeb thank you for your reply.
I went back to this question because I've figured it out myself and I was going to edit that I've fixed the issue. To my surprise, we have the same answer, more or less. My working solution is:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^mydomain\.abc$ [OR]
RewriteCond %{HTTP_HOST} ^www\.mydomain\.abc$
RewriteRule ^(.*)$ /apps/xyz/$1 [L]Thank you for taking time to respond. Cheers!
1
Please sign in to leave a comment.
Comments
2 comments