Support

Site Restoration

#25875 Htaccess when restoring to subdomain

Posted in ‘Site restoration’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Environment Information

PHP version
n/a
CMS Type
Other
CMS Version
n/a
Backup Tool Version
n/a
Kickstart version
n/a

Latest post by on Sunday, 02 October 2016 17:20 CDT

user89384
I've searched the documentation and forum and can't find an answer to my specific question.

I've built a Joomla site 'xyz.com', with custom htaccess using Admin Tools Pro 4.0.1. I've backed up the site with Akeeba Backup Pro 5.1.4. Before launch, I want to make a testing copy of the site at 'test.xyz.com'. I created a subdomain at public_html/test, and moved the backup files and kickstart.php into that test folder. I created a new database, and I think I am ready to extract and restore.

Before I extract, here's my question - should I be worried about htaccess conflicts between xyz.com and test.xyz.com? Is there a way in Admin Tools Pro to exclude the public_html/test folder from the main site's htaccess, and create a separate htaccess file for the test site?

Thank you in advance for your advice!

dlb
Yes, that is a problem. Your test site will inherit the .htaccess protections from the live site and it will not operate correctly.

You need to allow access to files, including php files, to the folder /test in the live site .htaccess file. You also need to uncheck the redirect index.php to root near the bottom of the .htaccess Maker screen.

You also need to exclude the /test folder from your live site's backup. If you are sharing a database, exclude the tables as well. That should do it.

If you can, create a public_html2 folder and put your test site in there. Some hosts allow this, some don't. That solves all of your inheritance problems.


Dale L. Brackin
Support Specialist


us.gifEnglish: native


Please keep in mind my timezone and cultural differences when reading my replies. Thank you!


????
My time zone is EST (UTC -5) (click here to see my current time in Philadelphia, PA)

user89384
Hi Dale, thanks for your help above and sorry for the long delay in responding. So I had to put the subdomain into public_html, I created a new database, restored with Kickstart and pointed the test site to the new database (confirmed in the backend). When I make a change in the test site backend, nothing happens to the test site or main site frontends. I don't have time to research and fix this myself, are you interested in a small paid project to fix this for me, and to make sure I have Backup Pro and htaccess configured properly for the main site and test site? (I can't imagine it would take more than half an hour for someone with good knowledge of Akeeba Backup Pro and Admin Tools Pro)

nicholas
Akeeba Staff
Manager
There is something even better you can do, for free :) Dale suggested it but didn't expand on it. Please let me explain this to you.

Create a new folder in the account root folder, above public_html i.e. in the same folder where public_html lives. The convention I use and propose is sudomain_html. For example, if my main site is www.example.com and the subdomain I am creating is foobar.example.com I create a folder foobar_html in the account's root folder.

Then create the subdomain in cPanel. It will ask you where to put the files. Delete the default entry of public_html/foobar and replace it with foobar_html. Now you can restore your site in your subdomain without much ado.

Why does that work? .htaccess files are designed to cascade through directories. Apache –your web server– looks in the folder of the file being accessed (e.g. Joomla's index.php) and all of its parent directories, until it hits the filesystem root, for .htaccess files. Then it merges them together and tries to make heads and tails of them. This is a very powerful and useful feature but gets in your way when you're trying to have an entire site inside another site's main folder e.g. a site in a subdomain directory inside your main site's public_html folder. By creating a new folder outside public_html we prevent that unwanted cascading.

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

user89384
Thanks Nicholas! This is where I show my semi-ignorance of server structures...just to clarify what you've said - if I have my main site (example.com) in root/public_html and put my subdomain (foobar) in root/foobar_html, navigating to foobar.example.com will still work. (I've been searching forums for weeks about this and haven't found a straight answer anywhere, you have no idea how much I appreciate this)

dlb
When you create the subdomain in your host's control panel it eill ask you what folder the URL should point to. The exact steps could well vary from one host to another, that's why you're getting mixed messages.


Dale L. Brackin
Support Specialist


us.gifEnglish: native


Please keep in mind my timezone and cultural differences when reading my replies. Thank you!


????
My time zone is EST (UTC -5) (click here to see my current time in Philadelphia, PA)

System Task
system
This ticket has been automatically closed. All tickets which have been inactive for a long time are automatically closed. If you believe that this ticket was closed in error, please contact us.

Support Information

Working hours: We are open Monday to Friday, 9am to 7pm Cyprus timezone (EET / EEST). Support is provided by the same developers writing the software, all of which live in Europe. You can still file tickets outside of our working hours, but we cannot respond to them until we're back at the office.

Support policy: We would like to kindly inform you that when using our support you have already agreed to the Support Policy which is part of our Terms of Service. Thank you for your understanding and for helping us help you!