We have registered account for hostinger and uploaded the Laravel 7 projects into the server and followed the steps from the following URL. But our projects are under the domains folder and as follows in the below picture
When accessing the URL, the default route is working but the other pages are not working and show error as the page is lost. Please suggest to us the right way to achieve this.
Thanks in advance.
It is probably due to rewrites rules are not enabled.
Is there any .htaccess in your public folder ? Maybe try to add the correct laravel 7 .htaccess with the needed rewrites rules.
public_html/.htaccess
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
Related
I have multiple codeigniter sites setup like so:
/CI_Site1
/CI_site1/CI_Site2
/CI_site1/CI_Site3
Right now to use my the second and and third site I have to do it like so:
mydomain.com/CI_Site2/index.php/controller/function
If I don't put the index.php then it throws up a 404 in the root site(AKA CI_Site1).
How should I configure htaccess or apache site conf or CI config files such that I don't have to add index.php?
I think the first step should be to configure the routes in CI_site1 to not process requests for the other 2 but I don't know how. Here is hoping a Codeigniter pro can help me.
Thanks in advance.
EDIT: I know how to remove index.php from URLs with htaccess. But that is not the issue here. How do I prevent CI_site1 from processing requests that are for CI_site2 and CI_site3?
Just add below code in file and save it as .htaccess then upload it to Project folder
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/system.*
RewriteRule ^(.*)$ index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?/$1 [L]
Make sure your server mod_rewrite is on.
Did you try using routes?
$route['CI_Site1'] = '/CI_Site1';
$route['CI_Site2'] = '/CI_site1/CI_Site2';
$route['CI_Site3'] = '/CI_site1/CI_Site3';
I realized that no extra configuration was required. It is sufficient to use .htaccess to remove index.php. My issue was that apache was blocking .htaccess files in its default configuration. Editing apache2.conf to allow processing of htaccess files resolved my issue.
In 2016/17 I had XAMPP working good but then I had one year rest and needed to reinstall Windows 10 and when I attempted to open the control panel it would not open.
I then decided to download the latest version of XAMPP and also CodeIgniter. I have transferred all of the files from the old version to the new version. I am able to open http://localhost/phpmyadmin and I have created a database with a table similar to that I had before. But if I enter http://localhost/intro I get the result of Object not found! - Error 404. I have checked routes.php and everything appears OK and I've also placed the Intro file (which is simple text without reference to the database) in the root folders of Controllers & Views, but get the same result. I have also checked config.php and changed $config['base_url'] = 'http://localhost/'; to $config['base_url'] = 'http://127.0.0.1:8080/localhost/'; but again it made no difference. I also changed the port number in the Control Panel to 8080 but again made no difference.
I guess by being able to open http://localhost/phpmyadmin that indicates Apache is working OK.
Can somebody tell me where else I can check?
If you are sure xampp is running perfectly then add .htaccess file in the main directory of the intro, add the following code into it:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$1 [PT,L]
and try again. If you got any error let me help you.
My old system had a .htaccess file and there was not one in my new system. I copied & pasted that file and everything works good now.
My file contained the following.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]
</IfModule>
Header add Access-Control-Allow-Origin "*"
I'm currently hosting several applications on a quite out-dated wamp version but that's not really the case. Everything is working fine on that part, besides my laravel application.
My .htaccess in the www folder looks like this;
RewriteCond %{HTTP_HOST} ^sapdfr.org$ [NC]
RewriteRule ^((?!sapdfr/websitev3).*)$ /sapdfr/websitev3/public/$1 [NC,L]
The thing that's strange, is that the first page is working but when I'm going deeper into the website, it just totally breaks. I've been trying to rewrite these rules but I'm seriously mindblown about all the possibilities. Any help will be greatly appreciated since I'm entirely lost here.
Maybe a silly question but have you try that ? :)
Laravel includes a public/.htaccess file that is used to provide URLs without the index.php front controller in the path. Before serving Laravel with Apache, be sure to enable the mod_rewrite module so the .htaccess file will be honored by the server.
If the .htaccess file that ships with Laravel does not work with your Apache installation, try this alternative:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
and then just redirect your domain to the laravel public folder
In DirectAdmin, I have changed the domainname of my project. But unfortunately it did not gave me the result I was looking for. So I undid my action. But, that did not solve the problem.
At first, I was able to access my site.com/public folder to use the assets for my website. But after my failure Laravel handles the /public directory as a route. So, I dan't have access anymore to my public folder and needed assets.
My domain: good2beout.nl
Can anyone help me?
P.s. I already looked at question Laravel 4 - public directory being treated as a route - image not showing but this does not solve my problem.
I have found my problem.
I accidentally overwrote my .htaccess file, replaced it with
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
https://laravel.com/docs/4.2#pretty-urls
I'm trying to figure out how to set up a domain and subdomain to work on a shared hosting account. It is a Laravel 5.1 application.
My access file is
Options +SymLinksIfOwnerMatch
RewriteEngine On
RewriteRule ^ index.php [L]
I just purchased another domain and added it on, but I get a 500 error. I renamed the access file and then it worked. So it has something to do with the access file. Essentially I want two separate domains with and I'm wanting two separate laravel applications, one for each.
I'm not familiar with atacceess.
Maybe, you get a redirect loop, because the rule isn't protected by a condition. Although the default htaccess of Laravel should already contain them.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [L]
Olaf Dietsche's answer does work for me.
Here is another thing I came upon a website that also worked just before I saw his post. I guess I was reading that this would send a 404 to that directory.
Options +SymLinksIfOwnerMatch
RewriteEngine On
RewriteRule ^ index.php [L]
RewriteCond %{HTTP_HOST} ^(www.)?main-topdomain.com$ [NC]
RewriteCond %{REQUEST_URI} ^/subdomain-folder/(.*)$
RewriteRule ^(.*)$ - [L,R=404]
So along with this comes another question if anyone is in my boat. I have my subdirectory inside of my root directory.***
dlaugh.com/public_html
laravel folders and access**
inluding
app
bootstrap
config
database
etc...
but also I have my sub folder
app
bootstrap
config
database
etc...
**mysubdomain in that folder**
Is it better practice to put
-main_domain_folder and
-subdomain_folder
in public_html
and then the
/app
/config
/database
would be in the main_domain_folder rather than passing the subdomain through the main domain?