I just was wondering if the robots.txt file is supposed to work like general robots txt files. So, you type for example "disallow/admin/*" place it into the the root Laravel folder and that's it.
Is it like this ?
Remember, that website address is relevant to public dir. So,
if you want robots.txt to work in Laravel, it must be placed in the public folder.
robots.txt is a special file used by search bots to read and crawl the website resources.
robots.txt should be at the root of the website.
The root directory differs from OS to OS. I am giving a few of them. Better that you consult with your server admin.
Example:
/public_html
/htdocs
/html
Related
I installed two codeigniter for desktop and mobile version. My directory structure is as follows:
www/projectfordesktop/application
www/projectfordesktop/uploads
www/projectfordesktop/projectformobile/application
My problem is that when I upload files from mobile site I want my file to be uploaded in main codeigniter application www/projectfordesktop/uploads. So, I want to access main codeigniter application base_url to www/projectfordesktop/projectformobile/. How is it possible.
I made two project because it redirect to m.project.com when accessed from mobile. And when access from desktop project.com. Is it good idea. If not, then is there any way I can use seperate view for mobile and desktop. Please help.
Thank you.
For security and a bunch of other reasons you absolutely do not want the upload folder in your application folder. And if at all possible you want your application folder and system folder above the public root. The other consideration - its possible and in some ways desirable to rename your application and system folder. So if your public folder is www
desktopapplication/www/
mobileappliction/www/
system306/www/
Now they are all safely above the public www, and they are labeled for what they are. Next you can have folders in the public folder, that contain the main index.php file for the specific application.
www/projectfordesktop/index.php
www/projectformobile/index.php
Open up the index.php file and redo the file paths to the application and system folder. Like
$system_path = '../../system306';
$application_folder = '../../desktopapplication';
The upload folder will now be either in www or one of the folders like projectfordesktop. Typically you would also put your css, js, etc files in there as well.
www/projectfordesktop/upload/
www/projectfordesktop/css/
www/projectfordesktop/js/
www/projectfordesktop/img/
Now - all the files which are public - are in a public folder. All the files which should be kept private - your application and system folder - are not public. And because you have labeled your application and system folder it makes it much easier to switch to different versions or revert back if needed.
In my Yii web application some of the directories are accessible from the public URL (main directory or application folder) like js, css, images etc. How to avoid this problem. This is a major security issue, but I don't know how to fix this. Please help me...
Thanks in advance...
If you're using Apache, you can restrict access to directories doing the following:
Create a .htaccess file in your directory so path/to/directory/to/deny/.htaccess
Open .htaccess and add Deny from all
You have to turn of apache directory listing. Use the link below.
How do I disable directory browsing?
Then change all files and folders permissions of a directory to 644 and 755.
Change all files and folders permissions of a directory to 644/755
Let me know if you need help
Here is some instructions given in documentation.
1) It's important that the directory be writable by the webserver user so that Yii can publish the resources there when needed.
2) When a project has multiple versions (production, testing, development, etc.) do not copy the assets/ folders from one area to another; allow Yii to deploy them automatically in each area.
3) Do not manually edit any file under assets/ - if you have a real need to make a change, find the publishing module, edit the source, delete the subfolder under assets/, and let Yii re-publish the updated files.
4) Do not reference names under the assets/ folder directly (say, to get at some other module's assets). If you need to use that
5) Do not add the contents of the assets/ folder to any source-code control system; these files have master source in other places.
6) It is safe to delete everything under assets/. Yii will re-publish the assets if they are not found under assets/.
Hope it will help you :)
I have a VPS and use PHP 5.5 and Apache 2.2 on a 64bit CentOS.
I have many domains on this VPS that used a shared library named core.
each Domain redirect to a directory with same name in apache html's directory. to be clear, this directory's structure is like this:
cd /var/www/html/
ls
core
site1_dir
site2_dir
site3_dir
site4_dir
...
for example http://www.site1.com root directory is /var/www/html/site1_dir
but there are many files and libraries in core that can't be address like this:
http://www.site1.com/../core/etc
so i created an empty folder, named core in each site's directory and i want to put a .htaccess file in them, in ordor to access core contents in each domains. for example:
http://www.site1.com/core/js/script.js must be a direct link from /var/www/html/core/js/script.js .
creating this .htaccess file is my question, and any other given options will be useful for me.
You should be able to create a symlink in each dir to the upper core dir and then work the files that way.
how can i know where is my web root folder ?
and how to put folders out of web root folder?
and how to test that they are not accessible from outside ?
the structure of my hosting is like this:
www.website.com :
public_html/
includes /
logs/
...
is it enough to protect includes folder and logs folder with htaccess? and are they out of web root in this case?
i know that $server[document root] provide the root of my website , but i am confused about how to put files out of it , any help would be welcome , thanks for all
All your files are currently in the public web root folder.
The 'inside' of your root is your publichtml/. Everything you place in there will be publicly accessible.
The name of your root can vary from host to host, often public_html or httpdocs.
The 'outside' is one directory up. But remember some hosts do not give enough permissions.
You cannot test documents outside your root, because they are not accessible. Only something like PHP can access those files. That's why you do not place your img/JS/CSS files outside the root cause they need direct access.
You can however serve them through your PHP.
I have a site on a server running Apache2 that resides at docroot /var/www/html. I want to access some of the files on a separate site at docroot /var/www/vhosts/othersite. Is there a way to access these files from the first site?
Thanks,
Chris Birk
You can include them using the include and require calls, or use symlinks to create a soft link in project 1 from project 2. These obviously depend on what you're actually trying to accomplish.
Edit: Oh, also, you could potentially add the folders you want to PATH.
The right way to do this is with mod_rewrite, and there are several ways of mapping URLs to different paths in the documentation here.
The cheatin' way of doing it would be to create a symbolic link from the directory outside the document root to a directory inside the document root, making sure the user Apache runs has can read that directory, and follow symlinks is turned on.
Yet another way of doing it would be to create a subdomain as a VirtualHost, with a document root of that other directory.