Domains & Subdirectories - .htaccess

I set up a WordPress installation for a friend under a subdirectory on my site. I have set up his domain name to point to the subdirectory of the installation (and I have his domain name registered under my GoDaddy account). I can't figure out how to configure my GoDaddy account or the WordPress installation to use his domain name for all his webpage's addresses.
For example, I want his website to display myfriendssite.com/about.php instead of mysite.com/friendswordpress/about.php
I have tried editing the .htaccess files for both my main sites directory and my friend's directory to no avail (I don't know what I'm doing). Please help!

Assuming you are using Apache, you should configure a virtual host with the myfriendssite.com and point it to the correct directory.
Because you haven't provided any example of the config code, I cannot give you specific example but please read through the apache doc for virtual host and you should find what you need. Here's the link
If you can post some sample of the relevant apache config, or specifics like sample domain and directories, I can help you more with a config example.

Related

Cpanel is not giving me option to change the root directory for one of my domains

I need to change the root directory for one of my domains,
But in my cpanel i dont find any options, just hard cores of system, but i have very basic knowledge about systems and servers.
How i can change that directory as easy as possible? I just need to change something because im gonna install laravel, and i want to change the public html to the public of laravel.
I was looking for the file that has the apache config, but it says like "the current config doesnt need to be changed or updated, bacause can be overryde", so i tought in Cpanel maybe i got an option for this.
Thanks, By the way i got an VPS, not shared. Using CENTOS 7.9.
Thanks and good night ^^
In cPanel, you can't change main domain directory/document root. If you want to change the document root, just change the main domain to another/random domain. Then add the domain that you want to change the root directory as addon domain
It's not recommended overriding Apache config. It's may break your system. WHM/cPanel exists to manage domains without a system admin knowledge
Do you try change this using console in Centos?
maybe will be better using console and open the file that contain the directory root

How to add a sub folder to a domain?

I have a domain xyz.com hosted on a hosting platform. I used file manager of cPanel to add all my website content and the site works perfectly when I access www.xyz.com. Now, I want to host a different version of my website which should work with the address www.xyz.com/version2, where "version2" is a new folder which I would be creating into which I would be ftp ing the files of the new version of the website. Please give some pointers on how can I can achieve this, so that I will have both xyz.com and xyz.com/version2 working as I explained.
Just create new folder with version2 name under public_html directory through file manager and upload your all content through FTP to your newly created directory. Update your site setting in configuration file and check your site.
I managed to solve the issue by creating a subdomain. I referred the below article for help,
http://www.inmotionhosting.com/support/edu/cpanel/cpanel-manage-domains/creating-a-subdomain

How can I move my old sites from shared host server to VPS?

I'm sure a lot of you guys used to be in the same situation as I am at right now.
Before
I used to owned shared hosting for about 2 years.
I kind of get used to it, whenever I create a new site.
I just need to upload my entire new folder including : index.html , styles, scripts, and other assets via FTP into the root directory to my shared host server. Then, I go to the url of that folder, I will see the site loaded, that's how I normally do it.
Now
I upgrade the way I host my site. I just recently purchased a VPS on Digital Ocean, and run Laravel application on it. Now, the site is way faster, and I have more control.
Unfortunately, I'm not sure what to do with all my old sites that I used to have.
How do move them into my new VPS ?
How do I go to them ? How is that work ?
Should I create a public_html folder or something ?
How can I achieve something like this ?
Any direction on this will be much appreciated !
Depending on your setup (single domain, multi-domain). If you're dealing with a single domain environment you'll just move everything over like normal. If you're in a multi-domain environment you'll need to point all your domains to the new server and setup different apache sites (config files) that point to their respective locations on disk.
In my experience with multi-domain environments and Apache 2.4 it's best to have /var/www/ be your center where you can store your .htpasswd or any other files like that, and a folder named public which has your outward facing websites in their subfolders.
Example:
web1.com would exist in /var/www/public/web1.com/...
web2.com would exist in /var/www/public/web2.com/...
You could alternatively have another public folder, but if you're specifically asking about laravel you'd want to point the apache config to the public directory as if you go any higher people have access to your .env file.
If you have everything in your single domain environment (public_html) and you now have a laravel site at your root you could alias a specific path to act as your "old site" data that points to a different folder than your laravel install.

How do I run a subdirectory on a seprate virtual directory on same server

I have a site, www.domain.com. I want to set up a blog which runs on a same server but in different virtual directory, and have it available a the domain www.domain.com/blog.
How would I go about doing this? If it were blog.domain.com, then it would be easy, but with www.domain.com/blog I'm not so sure.
I'm using Windows Server 2008 / IIS 7.
I have already been through these tutorial but If some one has better approach please do let me know
Tutorial1
Tutorial2
You should just be able to add it to the existing site. Something like
appcmd add VDIR /app.name:/<existingsite>/blog /path:/blog /physicalPath:/<whereYourBlogIs>
NOTE: appcmd is in the %windir%\system32\inetsrv\ directory on my machine.
Able to run subdirectory on seprate virtual directory using URL Rewrite v2 and Application Request Routing
For more detail please see here link

Drupal multisite setup

I am trying to setup drupal to host multiple sites which will not effect each other. My pages are hosted on a shared hosting service and I only have access to cPanel.
Following the instructions on the web that I found using google, I have done the following.
Installed Drupal.
Make a directory in sites and name it demo.sharedhost.com.
Copied default.settings.php in that directory and renamed it settings.php.
Created a subdomain demo.
Deleted the demo folder from public_html
Made sybolic link public_html/demo to sites/demo.myshost.com.
When I try to access demo.myhost.com I get listing of sites/demo.myhost.com directory instead of drupal installation.
Can you please help me setup multisites?
Thank you.
Finally I found the answer. In 6th step I made a symbolic link to drupal_installation/sites/demo.myhost.com, these instructions are wrong on the internet. The sybolic link should be targeted to drupal_installation path.
So here is my final steps:
Installed Drupal in ~/public_html/drupal_path.
Make a directory in ~/public_html/drupal_path/sites and name it demo.myhost.com.
Copied default.settings.php in ~/public_html/drupal_path/sites/demo.myhost.com directory and renamed it settings.php.
Created a subdomain demo.myhost.com.
Deleted the demo folder from public_html, which was created automatically.
Made sybolic link as follow:
ln -s ~/public_html/drupal_path ~/public_html/demo
Note: If you do not have access to shell then use the following php script to make the symlink:
<?php
exec("ln -s ~/public_html/drupal_path/ ~/public_html/demo");
?>
Finally visit the demo site by http://demo.myhost.com and you will be prompted for new drupal installation.
I am explaining the steps again so someone like me will not have to waste time reading different solutions posted on the internet.
Please let me know if something is not clear.
Multi Site in Drupal
You need to make sure first if the server supports virtual hosts or not ,
You have not created the database for sites , follow that link for this,
If all went well till now to install another site you shouldnt access
demo.myhost.com
instead try this
demo.myhost.com/install.php

Resources