Apache looks for index.php files in Laravel 5 - php

I am a begginer in Laravel and I am having troubles with Apache 2.2.15 on CentOS 6.5 and Laravel 5. I have searched for this error and I found some solutions for .htaccess and for httpd.conf but none of them are working and i get this error when trying to access "public/auth/register" or "public/auth/login" and even "/home":
Not Found
The requested URL /index.php was not found on this server.
Here is my .htaccess:
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
And here is my httpd.conf
<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
The only page that works is the public/index.php

You have to point apache to the public folder:
<VirtualHost *:80>
DocumentRoot /var/www/html/public
<Directory "/var/www/html/public">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

Related

Wordpress website crashes when allowoverride to All

the problem is that my wordpress website works but the pages give a 404 page not found error , so i followed these steps :
enabled mod_rewrite
my .htaccess file looks like this :
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
3- when i edit the value in /etc/apache2/apache2.conf
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
TO
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
the website crashes whenever i change the above value , i also tried to re install my apache server and nothing seems to work .

How to run multiple instances of Laravel on the same domain?

I have Apache 2.4 running on Windows Server 2012 with PHP 5.6.23 on port 8080.
Assume that the domain to my server is "serv1.example.com" I need to run 3 Laravel instances production,staging and dev using the following links
serv1.example.com:8080/production
serv1.example.com:8080/staging
serv1.example.com:8080/dev
I found another SO question which seems to be doing the same thing. But when I tried to do the same thing I get the following error
Forbidden
You don't have permission to access /dev on this server.
Here is what I have done so far. In my httpd-vhosts.conf file I added the following VirtualHost
<VirtualHost *:8080>
ErrorLog "logs/dev-error.log"
CustomLog "logs/dev-access.log" common
DocumentRoot "C:\www\dev\public"
ServerName serv1.example.com
ServerAlias /dev
<Directory "C:\www\dev">
Options Indexes Includes FollowSymLinks MultiViews
AllowOverride AuthConfig FileInfo Indexes
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Then I changed c:\www\dev\public\.htaccess the code to the following
<IfModule mod_rewrite.c>
#Options -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /dev/index.php/?$1 [L]
</IfModule>
What did I do wrong here? how can I access each instance using the same domain?
Try This one, in your Apache configure file /etc/apache2/sites-available
<VirtualHost *:8080>
ServerName serv1.example.com
ServerAlias serv1.example.com
DocumentRoot "C:/www/dev/public"
# Rewrites for pretty URLs, better not to rely on .htaccess.
<Directory "C:/www/dev/public">
Options All
AllowOverride All
Require all granted
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
</Directory>
# Log file locations
LogLevel warn
ErrorLog "logs/dev-error.log"
CustomLog "logs/dev-access.log" common
And in your c:\www\dev\public\.htaccess
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
I hope this would work. for more information follow these links.Multiple laravelsites on single apache server , multiple web sites in single laravel installation

Wordpress Permalinks 404 error with HTTPS host

My new permalinks continue displaying a 404 error on my site even after adding the AllowOverride and Rewrite modules parameters. Here is my default-ssl.conf file :
<IfModule mod_ssl.c>
<VirtualHost _default_:443>
ServerAdmin vincent.zzz#gmail.com
DocumentRoot /var/www/zzz
ServerName zzz.com.vn
ServerAlias www.zzz.com.vn
<Directory "/var/www/zzz">
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
<Location />
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
</Location>
#end of custon stuff.....
And here is the normal http part of my apache2.conf file :
<VirtualHost *:80>
ServerName zzz.com.vn
DocumentRoot /var/www/zzz
<Directory "/var/www/zzz">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
DirectoryIndex index.php
#force SSL
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=permanent]
</Directory>
Would anyone have an idea ?
Are you sure that mod_rewrite is enabled? Is there a symbolic link to rewrite.load in /etc/apache2/mods-enabled?
You can enable the mod with:
sudo a2enmod rewrite

Re-setting up working project on local machine

I'm working on a symfony 1.4 project which is working, i wanted to work on a local copy on my personal machine; so I've settled a virtual host (I'm on a Windows 8.1 with xamppp web server).
I'm getting a 500 error when trying to access from browser by giving "joyaa" (it's the virtualhost alias), and in some of my test I had a redirect to the project working on the server (it's a statement in .htaccess)
This is the virtual host defining:
<VirtualHost *:80>
ServerName joyaa
DocumentRoot "C:/xampp/htdocs/yaol/web"
DirectoryIndex index.php
<Directory "C:/xampp/htdocs/yaol/web">
AllowOverride All
Allow from All
</Directory>
Alias /sf C:/xampp/htdocs/yaol/lib/vendor/symfony/data/web/sf
<Directory "C:/xampp/htdocs/yaol/lib/vendor/symfony/data/web/sf">
AllowOverride All
Allow from All
</Directory>
Alias /joyaa "C:/xampp/htdocs/yaol/web"
<Directory "C:/xampp/htdocs/yaol/">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
and this is the .htaccess defining:
Options +FollowSymLinks +ExecCGI
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /joyaa
RewriteRule ^yaol(.*)$ http://www.arcadja.com/joyaa$1 [L,R=301]
# we check if the .html version is here (caching)
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
# no, so we redirect to our front web controller
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
Probably it's a configuration problem but I'm not sure about where to look at... Please help. Thanks

.htaccess throws 403 Forbidden / Zend Framework quickstart project creation (Mac OS X 10.6.5)

I am trying to get Zend Framework's quickstart tutorial up and running, but i ran into .htaccess issue. It seems if i remove the .htaccess file, the project runs fine, but if i leave it in there it throws a 403 Forbidden. The .htaccess is the default file generated by Zend Framework console command. Here is the .htaccess:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
This is under Mac OS X 10.6.5
mod_rewrite is on
AllowOveride All
Here is my virtual host info
<VirtualHost *:80>
ServerName zf_cms.local
DocumentRoot /Users/kjye/Sites/zf_cms/public
SetEnv APPLICATION_ENV "development"
<Directory /Users/kjye/Sites/zf_cms/public>
Options +Indexes +FollowSymLinks +ExecCGI
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
I fixed it by adding "Options +Indexes +FollowSymLinks +ExecCGI" Thanks for viewing.
<VirtualHost *:80>
ServerName zf_cms.local
DocumentRoot /Users/kjye/Sites/zf_cms/public
SetEnv APPLICATION_ENV "development"
<Directory /Users/kjye/Sites/zf_cms/public>
Options +Indexes +FollowSymLinks +ExecCGI
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
This turns out to work under mac os. thanks for all the help and comment.
I was having the same issue and added
Options +Indexes +FollowSymLinks +ExecCGI
Can someone shed some clarity on what the actual problem is and what this does to rectify it?

Categories