I have had a look to see if this has been answered but to no avail.
Perhaps is so obvious that it doesn't need answering?
I have made a subdomains folder on my server where I want to keep all my subdomains in.
Does this folder have to be in the public_html folder or can I have this folder on the root (same level as the public_html folder)?
I know this works as I have tried it, but is this good practice?
The reason I ask is because the subdomains can be access like a subfolder
e.g. www.mywebsite.com/subdomains/aNewSubdomain
Many thanks
If you can configure your web server freely, you can put the folder anywhere you like; actually, it is good not to have it in the public_html folder because that way, all subdomains would be accessible as sub folders of the main domain.
Related
I have a static website on an Apache server. I have an folder (who's name I don't give out to anyone else) that I don't want anyone to randomly stumble upon. Is there any way to have directory listing under a different page?
To clarify, I have directory listing turned off at the root folder of example.com. In the subfolder that correspondes to example.com/folder1/, I have another .htaccess that allows directory listing. However, I don't want someone who types in example.com/folder1/index.html or the equivalent to see the directory listing. I want them to have to go to example.com/folder1/otherindex.html to see the listing.
Is this possible with Apache?
Should be
DirectoryIndex filename
in your .htaccess
I have two domains hosted on GoDaddy cpanel - one is the primary and the other is an Addon. Each of the two domains has a live website hosted on it (both sites developed on Wordpress). Basically I just need to swap the Addon domain to become the primary domain. What's the best way of doing this?
I have researched and there are different approaches I gathered.
1- First approach is, to swap the primary domain website files (on File Manager) to be in a sub-folder under public_html. While the Addon domain website files to be placed directly under the root of the Public_HTML folder. Also to go into the Addon Domains option in cpanel, and do something about adding the "connect" to the Addon. I didn't understand what this meant. I can see my Addon domain is in the Addon Domains list. But not sure what else I need to do there?
2- Or I saw another way is, to create subfolders for each website and specify in the .htaccess (in the public_html) the folder which you want to be the main domain (after copying some template script of .htaccess and modyfying the main domain part of the script to be your domain). Then login to the Wordpress admin and in Setting ensure the wordpress address (url) and site address (url) are pointing to the correct sub folder under the domain hosted. Apparently the purpose of this approach is not to place an entire website folders and files directly under the root of public_html, which is very messy. But to keep each website organised in its own sub folder.
So which approach is more recommended? I.e. which is the least messy?
My last question is, I already have the main domain website folders and files directly under the root of the public_html. I don't know which folders and files belong to the website, that I need to move to a subfolder. Under the public_html, I have the following folders (exclusing subfolder of other websites, which obviously belongs to the other websites). I don't which of these folder are part of the main website (to move into a sub folder) and which folders are meant to stay under the public_html:
.htpasswds
.well-known
cgi-bin
hilositelock
oldwp-content
replica
test
wp-admin
wp-content
wp-includes
wpps-tools
Please refer to the info below about the hosting info (in case it's required):
Hosting Package: Ultimate
cPanel Version: 78.0 (build 27)
Apache Version: 2.4.39
PHP Version: 5.6.40
Operating System: linux
Many thanks
Here is the solution to your question.
If you want to swap both site's data (add-on and primary domain) then first take the backup(files and databases) of both websites using some plugin (As you are using WordPress).
Then set add-on domain as primary domain.
Now primary domain will become parked domain and add this parked domain as add-on domain and install a fresh WordPress on it.
Now you can simply restore backup of both sites using the plugin you had used for backup.
For Reference you can relate to this video.
I need to access to some static files in a folder from different domains. I've think that, instead of make several copies of that folder in each domain public folder, I could make some type of redirection or hard linking in apache for redirect them.
For example, I could access the common static files from www.abc.com/static/* and www.def.com/static/*, and internally, both urls point to the same folder "/home/static/*", transparently for the user and the browser.
You are looking for Alias.
What you want to do, however (creating an alias pointing to a directory outside the web root) needs to be done in the central configuration.
Alias /static /var/www/shared/static
I'm looking through my server because I want to restrict access to some specific folders and i've noticed I have several .htaccess files. One is in the root, the directory before public_html, is that the root, or is public_html the root? And that file enables php5 as default. I then have a htaccess doing some url re-writing in the public_html folder, then I have another one in the wordpress directory.
Is there a need for them to be spread out?
Do I have one htaccess for each folder I want affected or does the htaccess affect a folder plus all of the sub directories?
Thanks
Edit: Also have another htaccess in my wordpress theme folder?
Apache has two ways of storing configuration options:
The central configuration (the .conf files) - when you change these, you need to restart the server.
.htaccess files whose settings apply only to its directory, and all child directories. Changing these does not require a server restart
If you're on a dedicated server, you could theoretically migrate all .htaccess files into the central configuration, but WordPress will write into a .htaccess file when updating its permalink structure, so you'll always have at least that.
In my experience, keeping individual .htaccess files is relatively practical in everyday maintenance work as long as they're not too many. I would leave things as they are.
I've just altered wamp to use my external hard drive to use a folder in there as the DOcumentRoot.
The problem being, as all my sites are in seperate folders ie i:/www/sitename/public_html/
the folder public_html is not showing and I cannot access it. Is there a setting somewhere maybe in the htconf so I can access these folders.
regards
Phil Jackson
If your WAMP config has an entry along these lines:
UserDir public_html
I believe you will have to remove it. If not, or if that doesn't help, we probably need some more details about your config, and exactly what is happening.