Wordpress and php -...
 

[Closed] Wordpress and php - will they play nicely on same server?

Posts: 45997
Free Member
Topic starter
 

Random question...

We have a HTML and PHP based main website. To be replaced by autumn.

Temporarily I have a two of our older projects that were on Wordpress sites downloaded and hosting ended. I have two more sites about to end their hosting.

I would like to create a subfolder on server, install wordpress and upload the two old sites.

Will they play nicely this way? We would have mainsite.com and then mainsite.com/archive/oldsitenumberone etc

I am aware I need to check internal links, as the overall url will change, and this could be the main barrier as there are a few hundred pages that may need some changes....


 
Posted : 13/04/2018 10:22 am
Posts: 3272
Free Member
 

IIRC you need PHP in order for Wordpress to work in the first place.


 
Posted : 13/04/2018 10:31 am
Posts: 0
Free Member
 

I've done it locally at home - had Apache server with PHP running along with MySQL, installed Wordpress a few weeks ago and just used the same instances of the servers making sure to give Wordpress uniquely prefixed database tables. I was surprised that it went so easily TBH. So long as the new sites are within the documentRoot or whatever it's called in the Apache config file then it *should* work.

I think the WP installation process works out where it is and creates the .htaccess files to suite - I've not looked into it in detail though.


 
Posted : 13/04/2018 10:36 am
Posts: 3272
Free Member
 

Sorry, you were probably after a more detailed answer!

To agree with the above, I've had Apache hosting multiple websites (domains), some pointing to Wordpress sites and others just PHP sites with no issues.

It was a while ago and the configย was a bit of a battle but they might have simplified this now.


 
Posted : 13/04/2018 10:57 am
Posts: 0
Free Member
 

Think it should all work fine, assuming you're using different databases for each installation - the only thing that may cause issues (other than the broken links) is if there is a .htaccess file in the root directory that interferes with the WordPress .htaccess files in the sub folders?

Also grab something like https://en-gb.wordpress.org/plugins/velvet-blues-update-urls/ as a temporary measure and you should be able to update all the broken links with one setting - you may have to do the same for images/downloads etc too.


 
Posted : 13/04/2018 10:57 am
Posts: 0
Free Member
 

@joeydeacon - .htaccess files are searched from current folder upwards so if you've a sub-domain with an .htaccess file at its root then that will be used otherwise Apache looks in the parent folder, etc.


 
Posted : 13/04/2018 11:24 am
Posts: 0
Free Member
 

Ah.. ok I kinda assumed it would use the one in the sub folder, but didn't know if it was like CSS where if you don't specify a style for a certain element then it will use the one specified for the parent - so (prob wrongly) assumed anything not specified in the sub folder .htaccess might be taken from the one in the parent folder?


 
Posted : 13/04/2018 11:33 am
Posts: 0
Free Member
 

I can't remember if Apache stops when it finds an .htaccess file or continues upwards in an attempt to find a specific rule. It might depend on the value of documentRoot which is basically saying this is as far upwards as you can go. It's been a while since I've messed around with Apache configuration so don't take that as gospel.

CSS works top-down in terms of the DOM and top to bottom in terms of actual CSS files. So if you've two rules for a class of "myWidget" then both rules are combined but the one that is read second will overwrite any existing rules. There's also weighting depending on whether it's an ID, class, element or inline rule.


 
Posted : 13/04/2018 11:45 am