I have created a sub-domian and I want that as soon as the user goes to that domain, a file named web.php should automatically open rather than showind the web directory.
Please tell me if it is possible
Place an .htaccess file in the root directory of each created sub domain and fill it with:
DirectoryIndex web.php
Related
is it possible to change the old site that have been built so it can be accessed by something like this :
old site become : www.example.com/2021
and the new site : www.example.com
Thanks.
You can change document root or maybe just change route in config, visit https://codeigniter.com/userguide3/general/routing.html
Open the project folder on your new site. Open and edit the .env file at the new site's root project directory and change the line below:
app.baseURL = 'http://www.example.com'
Images getting stored in outside public folder and in view, getting called from inside public folder. Everything was working fine in local host. After uploading the project in cpanel i took index.php and htaccess outside public folder. How can i store and call them from same folder? Thank you.
When using Laravel all HTTP Requests has to be hit public directory. But since you are using cPanel all Requests hit directly public_html by default.
You tried to overcome it by moving index.php and .htaccess files to public_html from public_html/public and you broke its structure.
If you have the Administrative (eg: root) access on server, you can solve this by editing your Web server (I assume Apache in your case) to point your domain's requests directly to your Laraval application's public directory.
Usually every Web site in cPanel have separate config files. Their paths something like this:
/var/cpanel/userdata/CPANELUSER/WEBSITEDOMAIN.COM and /var/cpanel/userdata/CPANELUSER/WEBSITEDOMAIN.COM_SSL
In this files there is a documentroot field, it points to public_html directory by default:
documentroot: /home/CPANELUSER/public_html
You need to change it and point it to your application's public directory;
documentroot: /home/CPANELUSER/laravel/project/path/public
After you update both of these files, you need to rebuild your Apache config and restart it;
/usr/local/cpanel/scripts/rebuildhttpdconf
/usr/local/cpanel/scripts/restartsrv_httpd
If those 2 lines don't work, you can try this 2;
/scripts/rebuildhttpdconf
/scripts/restartsrv_apache
If everything done well, all HTTP Requests will hit your Laravel application's public directory as expected.
After that; if your uploaded files stores in public storage, Laravel puts them in to storage/app/public and you need a symlink to it from public directory.
Laravel creates it when you run
php artisan storage:link
Now all your application's requests as your.domain/storage/bla.jpg will give a response from storage/app/public/bla.jpg
And if you don't have administrative access to server you can check this tutorial: How to deploy Laravel 8 project on Cpanel shared hosting
i have my my website like abc.com/dev now i want to transfer it to abc.com,
what minimal changes should i do to make it work .
My website is in joomla is there way that i just move folder to main folder and add db setting.
Please guide i am new to joomla
Just Drag and drop your folders from your subdomain folder to root folder through FTP.
Then only changes you need to do is in your 'configuration.php' file located at the root folder. If your DB is not changed then do not change any of its setting. Just change the path of 'LOGS and TMP' folders in config file to the root path that are :
$log_path, $tmp_path
And I hope your site will work perfectly as it was working before.
I have a a project(codeigniter) where file directory is like that.
mysite
application
config
controllers
super_admin
admin.php
tasks
setup
bank.php
assets.php
Now if I try to access
http://localhost/mysite/tasks/seutp/bank
It calls codeigniter 404 page
But I can access
http://localhost/mysite/tasks/assets
Actually I can get access any controller under controllers and controllers/tasks folder.
But I cannot get access under controllers/tasks/setup folder
My question is
Is there any limitation of sub-directory at codeigniter?
If Yes: Is there any way to solve the limitation and How?
If No: Why I cannot access the third layer sub-directory controllers?Did I do something wrong?
yes there is a default for the ci controllers file folder levels. i am using this solution:
https://degreesofzero.com/article/controllers-in-sub-sub-folders-in-codeigniter.html
the author includes a lengthy mod rewrite but if you already have a working htaccess rewrite file to eliminate index.php from the url then it will probably work as is.
I am new to Laravel4, I was trying to run laravel4 on a shared hosting.Since I dont have root access, to avoid public in my url. I have moved all the contents in the public directory to "public_html" folder.
Then I changed the locations in respective files. But when I visited url "abc.com/myapp/app", it lists all the folders and files under app directory. Since it exposes the project files, I was looking to avoid the same.
In CodeIgniter if we try to access folders like this it gives message
"Directory access is forbidden."
Edit:
I have added
Options All FollowSymLinks MultiViews -Indexes
in a .htaccess file in the app folder as per suggested by #valey viktorovsky
There are multiple methods...
The easy one:
If you have access to .htaccess file and you can modify it, place this little code
Options -Indexes
Annoying one
If you cannot create/modify .htaccess file, create index.html file inside each folder you would like to protect