I'm new to Twig and was wondering where I should place the Twig /templates directory.
I'm using composer and placing the /templates in the root directory where the index.php is and it gives me the following error message :
Message: The "/templates" directory does not exist.
File: /home/teo/SERVER/public_html/JSON_FOLDER/JSON2/vendor/twig/twig/lib/Twig/Loader/Filesystem.php
Generally you put it anywhere not within your web root, that's the best practice. But if you have no access anywhere else, then the web root will have to do.
I'm not completely familiar with composer, but you'll probably want to specify a path that is relative to your web directory instead of an absolute directory like you've done already. That error shows that its trying to find a templates path in your server ROOT directory which is almost never going to be where you actually want it. Try just removing the leading slash in your config.
Related
I'm using Linux on Azure to host my webapp and it deploys fine. My local dev tree structure looks like this:
build
node_modules
src
.deployment
.env
.gitignore
package.json
README.json
...
When I deploy to Azure it looks like this:
dist
node_modules
Within one of my files I re-utilize some components from a node module like so:
import Password from '../../../node_modules/path/to/components/forms/field-types/Password';
There are 2 potential ways to make this work:
Deploy /dist into the root and have node_modules as a sibling but this then makes the relative path above break and ES6 doesn't allow dynamic import strings nor for them to be within blocks
Set the /dist folder as the application root which is actually correct (eg: it contains server.js) and then the relative paths would be correct
I'd prefer #2 however the capability for doing virtual path mapping in Azure doesn't seem to exist so it seems I'd need to leverage .htaccess. I'm curious if there are any other ways to do this and also if the root is set to /dist will the relative path still work or will it be blocked by the server?
Thanks.
.htaccess file setting **RewriteEngine On** on the request path. So if you add an admin-specific .htaccess file in the "subfolder" subfolder, this will preempt the www one and circumvent this problem.
EX:
RedirectMatch ^/my_folder/(.+)/card.jpg$ /script_folder/image.php?perameter=$1
This willredirect /my_folder/xyz/card.jpg to /script_folder/image.php?perameter=xyz changing the address bar from typed url to a new url. If you want the browser to stay on the typed url, you can use the following mod rewrite based solution :
RewriteEngine on
RewriteRule ^my_folder/(.+)/card.jpg$ /script_folder/image.php?perameter=$1 [L]
Please refer this DOC:
Deploy files to App Service - Azure App Service | Microsoft Learn
I read moodles documentation where it says that if the data root directory has to be in the site's public html folder ( Please see that i can not create it outside it since i dont have sufficient privileges as i am using a free account ). then you have to chmod it to 770 and also use htaccess to protect it.
Now i am creating the moodle inside my domain at folder /moodle/
and moodle uploads folder is /moodle-uploads/uploads/
and i have an .htaccess setup in /moodle-uploads/.htaccess
where its contents are
order deny,allow
deny from all
as specified on
http://docs.moodle.org/20/en/Creating_Moodle_site_data_directory
But still when i run the auto installer script it says the data root directory is not secure
This is not the best way of doing it but coding hack to just get rid of this error if you like try it..,
in moodle root go the install.php and if you are using 2.6 in line 341 or others versions search for is_dataroot_insecure() function and change it to false in the else if condition and try to install again,and that it..,
By default its going to give you warning for having it in the public html folder as according to the docs in the link you also provided.
Remember that by default moodle will issue a warning about moodle data
directories created inside the web directory, but otherwise this
directory can be located where you wish. You can later move or change
the location of this directory, but if you do, be sure to edit the
setting in the config.php file that sets this; e.g. if moodledata is
under a directory called data, then it would look like this:
As long as you have configured the dataroot location with the moodle data directory and placed your .htaccess file in that folder it should be fine.
i'm using moodle 2.4.1 and had a some problem. the solution open install.php file and search for statment
} else if (is_dataroot_insecure()) {
and disabled.
it's work for me
I have installed the plugin 'Advanced Search Plugin Like Facebook Search' of younet and I noticed the error that application/modules/Core/externals/scripts/ynadvsearch.php is not found.
Then I checked the location and the file was there. So I uploaded a test.php file and typed the url in address bar then also I could not access the test.php page. But I am able to access all the js pages on that folder.
I have deleted the htaccess file of external folder. But the issue remains the same.
How can we fix this?
It's a little weird, usually /externals/scripts folder is used only for javascript-files (and all php-files - inside of /controllers folder).
File .htaccess inside of /externals folder contains a rule
<FilesMatch "\.avi|flv|mov|wmv|wma|mp3|mp4|m4a|mkv|swf|pdf|doc|ppt|ico|jpg|jpeg|png|gif|js|css)$">`
It means that *.php files are not allowed for access inside of this folder.
I have a site http://www.gingerlily.fr
i copy those file and create sub directory on root called test and uploaded the file to it
duplicated db and apply update for all base url db and other configurations. (http://www.gingerlily.fr/test)
but the problem is when i access http://www.gingerlily.fr/test
site i always show root urls and other js and images loads from root magento installation. i try a day for thi but no luck.
can anyone help me for this something wrong with httacess file or any other wrong with this ?
thank you
I have seen your http://www.gingerlily.fr/. Correct me if i am wrong your trying to duplicate your site to test directory. But in magento your can't copy and duplicate site like PHP /Html here your files of magento site need to be first install and you can replace your module and theme files.
On our live site, coded by other developers, we have a globals file on the root. It's auto-prepended to each requested PHP file. Great.
We're now trying to make a development server to mirror our live, for internal purposes. I'm looking in their global config for apache, and I see this:
php_value auto_prepend_file /home/site/SITE/globals.php
However, while making an .htaccess file, I try to call the file using the direct URL, (based on the root of the server) and I get this error:
Fatal error: Unknown: Failed opening required 'opt/lampp/htdocs/globals.php'
(include_path='.:/opt/lampp/htdocs/site/SITE/include') in Unknown on line 0
It seems as though it's trying to use the include path for an auto-prepend. I can confirm that if I put just globals.php, it will work in the index and files on the root of the server. Do you guys have any leads as to what the problem could be?
Replacing our config file with the live one is not an option.
auto_prepend_file is being used when you want to include php file into every php file.
there are two kind of value it can has:
**File name**: in this case you put only file name and php searches according site's document root (or include path).
*Path & file name*: in this case you put file name and the path to file.
so, if their auto_prepend_file has the value /home/site/SITE/globals.php, so php looks in that path! so if you want to add that file into your php files you have to edit that php directive.