Magento 2 Gives 500 Error when .htaccess File Is Enabled - magento2

Magento 2 was Gives 500 Error, but when I renamed the .htaccess file it works. I removed the .htaccess file and replaced it with a fresh one with the content below, but that has not fixed the problem... when I enabled the .htaccess file, the 500 error came up again. Anyone had this issue with Magento 2 before? suggestions?
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/pub/
RewriteCond %{REQUEST_URI} !^/setup/
RewriteCond %{REQUEST_URI} !^/update/
RewriteCond %{REQUEST_URI} !^/dev/
RewriteRule .* /pub/$0 [L]
DirectoryIndex index.php
php_value memory_limit 2GB
php_value max_execution_time 18000

Related

Deploying Vue 3 App to subdomain of shared hosting (SiteGround)

I am trying to deploy my Vue 3 app on a subdomain of a shared hosting plan.
The main domain hosts a Wordpress Website.
I am adding the .htaccess file to the public_html folder of the subdomain.
It works fine, but when I reload a page I get a 404 response.
.htaccess
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</IfModule>

Deploying Laravel to Bluehost

I was wondering if anyone has had any experience deploying larval to blue host? I was flowing an youtube tutorial that showed how to deploy a larval application to a shared hosting service. It was using Godaddy.com, however, i was using Bluehost, and it didn't work as expected. However I managed to getting to not return an internal server error.
What I did was to configure the .env file so that it had my correct database information and my APP_URL to point to my domain.
The youtube tutorial said I should also remove everything from the public folder and place it in the applications main folder, which on Bluehost is the public_html folder. I also changed the .htaccess and removed the public in the rewrite that handles the redirects for trailing slashed.
Now, when I point to my website, all that is served up is a blank screen. but something seems to be working because I uploaded an html webpage that renders to the browser. I just wondering where do I go from here to get the entire site running.
i'm using php 5.6.
Any help would be great. Thank you
I think you are using shared hosting
Follow these steps
1: After upload files to public_html move all your /public files in public_html folder All files like index.php, .htaccess and assets folder etc
2: Find the following line in index.php
require __DIR__.’/../bootstrap/autoload.php’;
require __DIR__.’/../project/bootstrap/autoload.php’;
change to
require __DIR__.’/bootstrap/autoload.php’;
require __DIR__.’/project/bootstrap/autoload.php’;
That’s it. Well then, have fun.
check that the PHP version is correct for Laravel
in cPanle enable FastCGI for PHP
open file .htaccess located in /public and edit
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteBase /public/
# For security reasons, Option followsymlinks cannot be overridden.
# Options +FollowSymLinks
Options +SymLinksIfOwnerMatch
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
This is my .htaccess codes which are different in different server.
#Default Setup
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php72” package as the default “PHP” programming language.
<IfModule mime_module>
AddHandler application/x-httpd-ea-php72 .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit
//bluehost------------
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
RewriteBase /
# 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]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

ISPAI Rewrite 301 Redirects / SEO URL Canonicalization on Windows Server

I am new to working on a windows server and have been made aware that it is setup for ISPAI Rewrite.
I have tried creating a httpd.ini file and a .conf file with possible redirects but nothing is working.
Could someone show me how to create the correct file and then rewrite the following:
http://aspectexhibitions.co.uk/
Should redirect to:
http://www.aspectexhibitions.co.uk/
--
http://www.aspectexhibitions.co.uk/index.php
http://aspectexhibitions.co.uk/index.php
Should redirect to:
http://www.aspectexhibitions.co.uk/
Done...
[ISAPI_Rewrite]
#Redirect Non WWW to WWW
RewriteEngine on
RewriteCond %{HTTPS} (on)?
RewriteCond %{HTTP:Host} ^(?!www\.)(.+)$ [NC]
RewriteCond %{REQUEST_URI} (.+)
RewriteRule .? http(?%1s)://www.%2%3 [R=301,L]
#Redirect index.php to root
RewriteEngine on
RewriteBase /
RewriteRule ^index\.php$ http://www.aspectexhibitions.co.uk/ [NC,R=301,L]

htaccess 404 redirect problem

Merged with htaccess 404 redirect problem.
Here is my htaccess contents below. The 404 redirect is to redirect anyone to the index.htm page if they type in the wrong address or click a link that is broken or moved. The Problem is I get this "No input file specified." when a link is broken or typed wrong, here is an example www.cases.com/1234.htm
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} \.(gif|jpg|jpeg|png)$
RewriteRule .* products/noimage.jpg [L]
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^cases.com [NC]
RewriteRule ^(.*)$ http://www.cases.com/$1 [L,R=301]
RewriteEngine On
Options +FollowSymlinks
RewriteBase /
# Rewrite Rule for blog.cases.com
RewriteCond %{HTTP_HOST} blog.cases.com$
RewriteCond %{REQUEST_URI} !blog/
RewriteRule ^(.*)$ blog/$1
ErrorDocument 404 /index.htm
AddType application/x-httpd-php .htm .html .php

400 Bad Request With CSS .htaccess rule

I'm trying to whitelabel the Zend framework, so I've created folder in application called Site.
This url: http://local.branch.test.com/site-css/1/layout.css returns a 400 Bad Request.
With the following rule:
RewriteRule ^site-css/([0-9]+)/(.*)$ ../application/site/$1/design/css/$2 [L]
Full .htaccess
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule !\.(js|ico|gif|jpg|png|css)$ /index.php
RewriteRule ^site-css/([0-9]+)/(.*)$ ../application/site/$1/design/css/$2 [L]
Ideas?
Try
RewriteBase /
RewriteRule ^site-css/([0-9]+)/(.*)$ ../application/site/$1/design/css/$2 [L]
This is caused by apache being set up to point to /public. The project doesn't have access to read files outside of its root.
Therefore I have moved site into public.