I have Apache/2.2.22 (Ubuntu). Site directory:
.htaccess
index.php
catalog.php
When I type in browser:
site.local/about-company - redirect to index.php
site.local/faq - redirect to index.php
site.local/catalog - return 404
**.htaccess**
DirectoryIndex index.php
RewriteEngine On
Options +FollowSymlinks
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php
Ubuntu 14.04 have only Apache/2.4.7
This version Apache with bug in mod_rewrite module.
Now on http://apache.org actually version is 2.4.9. Use this or wait 2.4.9 in Ubuntu Server.
Related
I have Laravel 6 running well on my localhost but when I deploy on domainsite.com, it only shows the main page but the rest of links shows 404 page not found. I am using CentOS 7, aaPanel running nginx server. PHP 7.4 MySQL.
I have this config so far.
URL Rewrite:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
fileinfo installed
I have removed in Disabled Functions(putenv and symlink) but still I get the error.
Anyone have tried this? Thank you!
I am trying to deploy a Laravel 7 application to Elastic BeanStalk but having some problem with the routing.
I have followed the tutorial from the video below and upload the zip archive with all my local files.
I have also fixed the permission issue after having set the root to /public.
Currently, the only page visible is the homepage whereas al the other pages like /login, /register and the other show me a 404
here is the log of the from eb:
2020/05/01 14:19:30 [error] 4091#0: *4 open() "/var/www/html/public/login" failed (2: No such file or directory), client: 82.4.194.3, server: , request: "GET /login HTTP/1.1"
https://www.youtube.com/watch?v=ISVaMijczKc
I suppose you are using Beanstalk PHP platform with Linux in version 2; this version uses Nginx (whereas the previous version uses Apache).
You can see more details in the official documentation: https://docs.aws.amazon.com/elasticbeanstalk/latest/platforms/platforms-supported.html#platforms-supported.PHP
In that case, you have to configure Nginx for redirection as described in the Laravel documentation: https://laravel.com/docs/7.x/deployment#nginx
Just create the file .platform/nginx/conf.d/elasticbeanstalk/laravel.conf (at the root of your project):
location / {
try_files $uri $uri/ /index.php?$query_string;
}
Feel free to add other configuration for your need.
You will find more details about extending the platform here: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/platforms-linux-extend.html
After several attempts, I have it up and running. I had deleted the application and used EB CLI to create it again.
I created an environment config and placed it in .ebextentions and I added AllowOverride All
Here is the content of my 01-environment.config
option_settings:
aws:elasticbeanstalk:container:php:phpini:
document_root: /public
composer_options: --no-dev
aws:elasticbeanstalk:application:environment:
APP_ENV: production
APP_KEY: base64:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
and my .htaccess file
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
AllowOverride All
# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
I'm working on a website using codeigniter framework. I pasted all the package to phpdesktop because we were trying to convert it to desktop application which worked well. But when I move the folder to htdocs in xamp it failed to run, giving the below error:
Server error!
The server encountered an internal error and was unable to complete
your request. Either the server is overloaded or there was an error in
a CGI script.
If you think this is a server error, please contact the webmaster.
Error 500 localhost
Apache/2.4.39 (Win64) OpenSSL/1.1.1b PHP/7.3.5
when I checked apache error log, I have this displayed:
[Fri May 10 18:36:37.353885 2019] [core:alert] [pid 14880:tid 1912]
[client ::1:58528] C:/xampp/htdocs/law/.htaccess: Invalid command
'//', perhaps misspelled or defined by a module not included in the
server configuration
htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ sys_info/$1 [L]
How can I resolve it. It worked perfectly in phpdesktop in addition.
have you configured your index_page on config.php already? I you just leave it blank, here's a sample of .htaccess that's working for me:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
Hope this helps!
I have a laravel project. When I host it in a subdomain and add the file .htaccess to redirect to the public folder, I get the HTTP ERROR 500. First I thought that the error was from the host, but I changed the project and it worked, so the problem has to be the laravel.
my .htaccess file
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
I don't have any idea to resolve it.
Can any one help me?
I have some legacy apps running Laravel with Apache and for them this is the .htaccess that I use to redirect to the public folder.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/public/
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
I've just setup an AMP server on OSX 10.9 and have a bizzare problem which is not present on my live hosting server or my old WAMP server.
I want to redirect any URL that doesn't directly map to a file on the server to index.php. I'm using the following .htaccess code
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# prevent loop
RewriteCond %{REQUEST_URI} !index\.php
RewriteRule ^(.*)$ /index.php?/$1 [L]
when I try http://example.com/example there is no problem, but when I introduce another slash, for example, http://example.com/example/
I get the a 404 error The requested URL /example.html/ was not found on this server.
Server version: Apache/2.2.26 (Unix)
Looks like your problem is related to enabling of MultiViews here. Turn it off by using this line on top of your .htaccess:
Options -MultiViews
Option MultiViews is used by Apache's content negotiation module that runs before mod_rewrite and and makes Apache server match extensions of files. So /file can be in URL but it will serve /file.php.