I may have created a more complicated situation than I should have but here I am. Stuck…
I have an existing site in the root public_html folder at A2 hosting.
I build a new site in a folder public_html/new. I’m trying to get the domain to point to the /new folder and I’m in over my head.
Since the domain is already pointing to the server, I assumed that domain needs to be redirected to the /new folder via the .htaccess. Is that correct? If there’s an easier or more straightforward way please enlighten me. If not, I’ll need help with the htaccess.
I asked the A2 tech support for help with the code for the .htaccess and they put this in the file.
RewriteCond %{HTTP_HOST} ^(www.)?mydomain.com$
RewriteCond %{REQUEST_URI} !^/new/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /new/$1
RewriteCond %{HTTP_HOST} ^(www.)?mydomain.com$
RewriteRule ^(/)?$ new/index.php [L]
This worked for the home page, but all the internal pages still included the /new in the url e.g. mydomain.com/new/index.php?id=11
I thought the base href might be the problem, so I tried both of these variations. Neither had any affect.
I’m wondering if any of the remaining htaccess code must be modified as well as what the A2 tech inserted. Here’s the entire file.
RewriteCond %{HTTP_HOST} ^(www.)?mydomain.com$
RewriteCond %{REQUEST_URI} !^/new/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /new/$1
RewriteCond %{HTTP_HOST} ^(www.)?mydomain.com$
RewriteRule ^(/)?$ new/index.php [L]
RewriteEngine On
RewriteBase /
# Rewrite www.domain.com -> domain.com -- used with SEO Strict URLs plugin
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} ^www.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
# The Friendly URLs part
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteCond %{REQUEST_URI} !^/\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/(?:\ Ballot169)?
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
#Disable HSTS
Header always unset Strict-Transport-Security
Any help is appreciated.