Laravel5 Ubuntu only working when myvirtualdomain/index.php/subsites - php

I'm using Ubuntu 14.04. I have installed LAMP, Composer and I installed Laravel. I created virtual domain (laravel.dev) and it works, but only when I'm using for simple laravel.dev/index.php/auth/login. When I use laravel.dev/css I have laravel/public/css folder. I have default .htaccess file:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
AllowOverride All
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
And my *.conf file:
<VirtualHost *:80>
ServerName laravel.dev
ServerAdmin webmaster#laravel.dev
DocumentRoot /var/www/laravel/public
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
How can I fix it?
My main page:
http://i.imgur.com/AxQjV9q.png

I fall this problem.I solved it using apache mod rewrite enable.For that follow this
http://www.kingpabel.com/apache-mod_rewrite/

Currently, your virtualhost doesn't allow overriding the rewriting settings in the .htaccess of your project.
You should add the following lines to your .conf file, in the virtualhost :
<Directory "/var/www/laravel/public">
AllowOverride All
</Directory>
Which would result in the following file :
<VirtualHost *:80>
ServerName laravel.dev
ServerAdmin webmaster#laravel.dev
DocumentRoot /var/www/laravel/public
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory "/var/www/laravel/public">
AllowOverride All
</Directory>
</VirtualHost>

Related

Symfony app show .php extension in url and loop login page

I have a website made with Symfony 2.8.22 running with Apache 2.4.18. I have RewriteEngine activated in the virtualhost to not show the .php extension in the url. However I have 2 problems. The first one is I do get the .php extension via url. The second problem is I have a loop in the login page; once I input the credentials it reloads the same login page again, and again. That happens in Chrome and Firefox, however in Microsoft Edge that loop wont happen, it just follow to the next page.
Why is that?
Where's my virtualhost file:
<VirtualHost *:80>
ServerName ip.ip.ip.ip
DocumentRoot /var/www/html/website/web
<Directory /var/www/html/website/web>
AllowOverride All
Order Allow,Deny
Allow from All
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteRule (.*)\.php $1 [R=301,L]
</IfModule>
</Directory>
<Directory /var/www/project>
Options FollowSymlinks
</Directory>
ErrorLog /var/log/apache2/error_website.log
CustomLog /var/log/apache2/access_website.log combined
</VirtualHost>
Thanks in advance.
Best regards.
I am not certain why you are trying to forcably remove .php from the web address bar. If you follow the Symfony Configuration guide it will give you an .htaccess file that works and will not display .php extensions:
<VirtualHost *:80>
ServerName domain.tld
ServerAlias www.domain.tld
DocumentRoot /var/www/project/web
<Directory /var/www/project/web>
AllowOverride None
Order Allow,Deny
Allow from All
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app.php [QSA,L]
</IfModule>
</Directory>
# uncomment the following lines if you install assets as symlinks
# or run into problems when compiling LESS/Sass/CoffeeScript assets
# <Directory /var/www/project>
# Options FollowSymlinks
# </Directory>
# optionally disable the RewriteEngine for the asset directories
# which will allow apache to simply reply with a 404 when files are
# not found instead of passing the request into the full symfony stack
<Directory /var/www/project/web/bundles>
<IfModule mod_rewrite.c>
RewriteEngine Off
</IfModule>
</Directory>
ErrorLog /var/log/apache2/project_error.log
CustomLog /var/log/apache2/project_access.log combined
</VirtualHost>

what will be my .htaccess setting?

I currently using CodeIgniter 3. It is working on my laptop.
But when I upload it to my Centos 6.9 server... I encounter an error.
I already check the mod_rewrite is loaded.
I want it to be like this URL/controller/method (no index.php after URL)
It shows me a 404 when i try to login which redirect me to this URL/gate/login
I also set this....
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';
My htaccess on /var/www/html/calllist
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /calllist/index.php?/$1 [L]
</IfModule>
My httpd.conf
DocumentRoot "/var/www/html"
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<VirtualHost *:80>
ServerAdmin webmaster#xxxx.com
DocumentRoot /var/www/html/calllist
ServerName www.xxxx.com
ErrorLog /var/www/html/calllist/error_log
CustomLog /var/www/html/calllist/requests.log common
</VirtualHost>
i solved the issue.
apparently on httpd.conf, there is another line i need to set to 'All'.
and i added this to my virtual host
<Directory "/var/www/html/calllist">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>

codeigniter, htaccess force https except one url

I try to force all urls to https except one url. so far no success. Anyone knows what is wrong with my htaccess or codeignter?
Url test 1:
http://hub-dev-1.andatech.com.au/utility/mandrills/email_bounced_back
Should stays as
http://hub-dev-1.andatech.com.au/utility/mandrills/email_bounced_back
Url test 2:
http://hub-dev-1.andatech.com.au/controller/method
I use this tool to test htaccess: http://htaccess.mwl.be/
Here is my htaccess
RewriteOptions inherit
RewriteEngine on
RewriteCond %{HTTPS} !=on
RewriteCond %{REQUEST_URI} !^/utility/mandrills/email_bounced_back
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{REQUEST_URI} !^/(assets|test)/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ index.php/$1 [PT,L]
Header set Access-Control-Allow-Origin "*"
Test on http://htaccess.mwl.be, working.
Test on browser,
http://hub-dev-1.andatech.com.au/utility/mandrills/email_bounced_back redirects to
https://hub-dev-1.andatech.com.au/utility/mandrills/email_bounced_back
apache conf:
<VirtualHost *:80>
ServerAdmin test#test.com
ServerName hub-dev-1.andatech.com.au
ServerAlias www.hub-dev-1.andatech.com.au
DocumentRoot /home/thehub/public_html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /home/thehub/public_html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
# Hak apache 2.2
# Order deny,allow
Allow from all
# Hak apache 2.4
Require all granted
</Directory>
</VirtualHost>
ssl apache conf
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerAdmin test#test.com
ServerName hub-dev-1.andatech.com.au
ServerAlias www.hub-dev-1.andatech.com.au
DocumentRoot /home/thehub/public_html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /home/thehub/public_html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
# Hak apache 2.2
# Order deny,allow
Allow from all
# Hak apache 2.4
Require all granted
</Directory>
SSLCertificateFile /etc/letsencrypt/live/hub-dev-1.andatech.com.au/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/hub-dev-1.andatech.com.au/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>

Laravel 5.1 .htaccess not working (pretty url's)

So I have tried both versions of the .htaccess, the one that comes with it in project creation and the one in the documentation. I am currently using the one in the documentation:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
I have my virtualhost set up like so:
<VirtualHost *:80>
ServerAdmin <my email>
ServerName projectflyer.<my domain>.com
DocumentRoot /var/www/html/projects/project-flyer/public
DirectoryIndex index.php
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
However when I go to projectflyer.mydomain.com/some/route I get back a 404. Any ideas? Yes I can go to the base url just fine.
I solved this by adding this to my virtualhost .conf file:
<Directory /path/to/your/install/public/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Thanks to http://laravel.io/forum/09-15-2015-removing-indexphp-from-url-laravel-5116 for the answer

Wordpress Permalinks Not Working On New Server

My server was recently compromised. I moved everything to a new server, but for some reason the permalinks for the Wordpress site are not working properly. I've looked everything over and it all appears to be correct, but I can't see why the links won't work when the settings were all copied over from the old server where they all worked.
Server .conf:
<VirtualHost *:80>
ServerName www.XXX.com
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html/XXX.com/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
<VirtualHost *:80>
ServerAlias XXX.com
ServerAdmin XXX
DocumentRoot /var/www/html/XXX.com/
ServerName www.XXX.com
DirectoryIndex index.html index.php
<Directory "/var/www/html/www.XXX.com/">
allow from all
Options -Indexes
AllowOverride All
</Directory>
CustomLog ${APACHELOGDIR}/XXX.log common
ErrorLog ${APACHELOGDIR}/XXX-error.log
</VirtualHost>
.htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUESTFILENAME} !-f
RewriteCond %{REQUESTFILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
Make sure .htaccess has right permissions so that wordpress can change it on its own.

Categories