2 domains - 2 sites - Wordpress - Subfolders?
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Plusnet Community
- :
- Forum
- :
- Help with my Plusnet services
- :
- Everything else
- :
- Re: 2 domains - 2 sites - Wordpress - Subfolders?
2 domains - 2 sites - Wordpress - Subfolders?
24-08-2014 9:25 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
There must be a straight forward answer to this?
I have 2 domains hosted with you, lets call them example1.co.uk and example2.co.uk.
example1.co.uk has had the DNS records changed to point to 91.136.8.9 (hostopia) and everything works well.
the database is live, the .htaccess is fine, and the user sees example.co.uk when they visit the homepage. Easy.
Now, I have example2.co.uk that currently points to old (/htdocs) webspace and does not have the DNS records changed yet.
I have also set up a subfolder for example2.co.uk in the main /public folder from within myPhpAdmin and installed a another copy of WP as example1.co.uk has its own in the root of /public
I have also set up a database and user using MySqlManager and everything works well.
If I go to ccgi.username.plus.com I am directed to example1.co.uk, brilliant!
If I go to ccgi.username.plus.com/subfolder I can see the new Wordpress site and everything works well.
If I set the DNS records on example2.co.uk to point to 91.136.8.9, how can the server differentiate between the domains and point the example2.co.uk to the sub folder?
To complicate matters slightly, I am thinking of a third domain and would really like to put all websites in subfolders and get the domains to point to each folder, each with a copy of WP installed?
Important. On the homepage, the user needs to see example2.co.uk and not example2.co.uk/subfolder/
Hope all this makes sense.
PS - I am reletively competent at moving files, altering .htacess etc..., thanks!
Richard
Re: 2 domains - 2 sites - Wordpress - Subfolders?
24-08-2014 10:15 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Then on a purpose click it redirected through http://splitter.ndsplitter.com/beam.php?target=aHR0cDovL2NsaWNrcy5iZXN0cXVhbGl0eXNlYXJjaC5jb20vZmx5P... then through http://ww20.domain1.co.uk/ then looped through a few times before finally landing on http://www.mysupermarket.co.uk/shelf/Dental?banner=56430&utm_medium=email&utm_source=MediaBuy_UK&utm...
Re: 2 domains - 2 sites - Wordpress - Subfolders?
24-08-2014 10:19 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Re: 2 domains - 2 sites - Wordpress - Subfolders?
24-08-2014 10:21 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
If you stick a .htaccess file in your root folder (create as 'my.htaccess', save as txt, upload as ascii, delete 'my', set permissions 640):
Code:
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+[^/])$ $1/ [R,L]
RewriteCond %{HTTP_HOST} ^(www\.)?mydomain\.co\.uk$ [NC]
RewriteCond %{REQUEST_URI} !^/~username/folder/
RewriteRule (.*) /folder/$1
changing mydomain, username and folder (twice) appropriately, then your domain will point straight at your blog.
Could I put this code into a single htaccess file twice? Once for domain1 pointing to domain1/subfolder and another for domain2 pointing to domain2/subfolder?
Thanks
Re: 2 domains - 2 sites - Wordpress - Subfolders?
24-08-2014 10:23 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Re: 2 domains - 2 sites - Wordpress - Subfolders?
24-08-2014 10:44 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Re: 2 domains - 2 sites - Wordpress - Subfolders?
24-08-2014 10:51 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Re: 2 domains - 2 sites - Wordpress - Subfolders?
24-08-2014 3:52 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Quote from: oakbydesign
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+[^/])$ $1/ [R,L]
RewriteCond %{HTTP_HOST} ^(www\.)?mydomain\.co\.uk$ [NC]
RewriteCond %{REQUEST_URI} !^/~username/folder/
RewriteRule (.*) /folder/$1
Could I put this code into a single htaccess file twice? Once for domain1 pointing to domain1/subfolder and another for domain2 pointing to domain2/subfolder?
(code block spaced out for clarity)
Yes, you can do this, but need to make small changes. The first rewrite rule needs to occur once only. It adds a trailing slash on the address line if a directory is requested but the URL does not have one. Note that a slash will not be added for domain only requests.
The presence of ~username in the conditions for the last rewrite rule applied on the old Plusnet ccgi hosting, but this needs to be removed for Hostopia. (This condition is to prevent the rule looping, endlessly adding /folder/ .)
The rule should be terminated by
Based on Gabe's post here, allowing for any subdomain prefix (including none), with appropriate substitutions I think the following rules should meet your needs
RewriteCond %{HTTP_HOST} ^([^.]+\.)?yourdomain1\.co\.uk$ [NC]
RewriteCond %{REQUEST_URI} !^/cgi-bin/
RewriteCond %{REQUEST_URI} !^/yoursite1/
RewriteRule (.*) /yoursite1/$1
RewriteCond %{HTTP_HOST} ^([^.]+\.)?yourdomain2\.co\.uk$ [NC]
RewriteCond %{REQUEST_URI} !^/cgi-bin/
RewriteCond %{REQUEST_URI} !^/yoursite2/
RewriteRule (.*) /yoursite2/$1
Excluding /cgi-bin might or might not be necessary, depending how /public is set up. An exclusion will also be needed for any other folders you want to use that are not under /yoursite.
On each WordPress configuration page you would need to set the desired domain URLs (without /yoursite) to avoid the folder names appearing in address lines.
David
Re: 2 domains - 2 sites - Wordpress - Subfolders?
25-08-2014 6:58 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
I will set up to the domain and alter the htaccess file.
I have attached a small screenshot of my /public folder.
Would be right in assuming the htaccess files sits in the /public folder and the 2 copies of WP and themes etc, sit in the subfolders?
I take it there are no htaccess files in these subfolders?
Thanks
Re: 2 domains - 2 sites - Wordpress - Subfolders?
25-08-2014 2:39 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
If you are intending to move your existing /public located WordPress installation into its own subfolder (that would be my choice) you need to be aware that as well as moving /wp-admin, /wp-content and /wp-includes there are also around 25 standard files to be moved.
The second WordPress installation would start off in its own (separate) subfolder. Note that you can share MySQL databases by using a different installation prefix (wp_, wp2_, etc).
There will be numerous .htaccess files in the WordPress folders, but these are part of WordPress and should not be changed by the user.
David
Re: 2 domains - 2 sites - Wordpress - Subfolders?
26-08-2014 7:18 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Thanks again.
Just to be clear, can the htaccess file in the /public folder contain all information? ie.. redirects for both sites, theme security code etc...?
Or would it be better to have a htaccess file in the /public showing the rewrite rules you gave earlier and 2 other htaccess files in the subfolders for the redirects for each site?
Richard
Re: 2 domains - 2 sites - Wordpress - Subfolders?
26-08-2014 3:50 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
The rules rewriting domain filepaths into their subfolders must necessarily be in /public.
David
Re: 2 domains - 2 sites - Wordpress - Subfolders?
27-08-2014 6:42 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Re: 2 domains - 2 sites - Wordpress - Subfolders?
31-08-2014 6:45 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, or webmaster and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
i did the following
Moved all files associated with site1 (oakbydesign) from the public folder to a subfolder called 'obd''
Put the htaccess code as follows in the public folder.
RewriteCond %{HTTP_HOST} ^([^.]+\.)?oakbydesign\.co\.uk$ [NC]
RewriteCond %{REQUEST_URI} !^/cgi-bin/
RewriteCond %{REQUEST_URI} !^/obd
RewriteRule (.*) /obd/$1
Also tried removing the \'s in the first line to read oakbydesign.co.uk$ [NC]
Also tried adding a www. at the beginning
My original htaccess that I moved over from /public to /public/obd looks like this.
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ -
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php
</IfModule>
# END WordPress
Do I need to change any other files in WP, update links or anything in the database?
As the site works ok in the public folder, I have moved everything back for now.
I really wanted to launch a different and new WP site that is sat ready in another subfolder by tomorrow and was testing the oakbydesign site first by moving it also to a subfolder.
This new site currently points to PN webspace as it is a html website.
Thanks
Richard
Many thanks
Richard
Re: 2 domains - 2 sites - Wordpress - Subfolders?
31-08-2014 9:02 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
I had to change the upload folder (images) to read obd/wp-content/
AND
change the permissions on the htaccess foe to 640 not 644, i think. Anyway 640 works!
The htaccess file in the public folder now looks like this
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+[^/])$ $1/ [R,L]
RewriteCond %{HTTP_HOST} ^(www\.)?oakbydesign\.co\.uk$ [NC]
RewriteCond %{REQUEST_URI} !^/obd/
RewriteRule (.*) /obd/$1
Just need to point the next domain to hostopia and modify the htaccess.
Cheers
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Plusnet Community
- :
- Forum
- :
- Help with my Plusnet services
- :
- Everything else
- :
- Re: 2 domains - 2 sites - Wordpress - Subfolders?