I have the following .htaccess fille:
<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]
# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
#disable directory browsing
Options -Indexes
#PROTECT ENV FILE
<Files .env>
order allow,deny
Deny from all
</Files>
#PROTECT ENV FILE
<Files .htaccess>
order allow,deny
Deny from all
</Files>
But the problem is I get a 404 status code in my production environment when trying to load "getservicedata" from a vue.js component. I think the problem is in the URL because it works when I type in the correct url, but the problem is the app loads the API from wrong URL.
I followed this guide to setup laravel shared hosting: https://laravelarticle.com/deploy-laravel-on-shared-hosting
Related
I got error in my website after I add .htaccess file in the root folder of my website, I use laravel 8 and storage in my website, note i have run php artisan storage:link, please help me anyone. thank you
this is .htaccess configuration :
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
and this is my .htaccess configuration in public directory :
<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]
# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
I transferred my Laravel project to hosting, but I get a 403 not found error. What do you think is the reason?
.htcaccess 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]
Options +FollowSymLinks
</IfModule>
I have setup on host my 5.4 Laravel project.Everything used to work just fine but now when i try to access any page other then homepage i get 404 not found even when i want to access phpmyadmin panel (www.mywebsite.com/phpmyadmin).Is this a .htaccess config problem or something wrong with the server or domain ?
this is my .htaccess file content :
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
You have to change the apache config to accept what is written in .htaccess file. This would help https://stackoverflow.com/questions/24784606/laravel-routes-not-working-apache-configuration-only-allows-for-public-index-ph
I'm trying to include https in my Laravel Project without using godaddy only using htaccess and not that big deal since I'm using proxypass from my SSL certified website that will pass to my laravel project.
I just need to make my laravel project to https.
So I tried to add this code to my .htaccess located at public/
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://myproject.com/$1 [R=301,L]
Here's my public/.htaccess
<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]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
UPDATED
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# 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]
</IfModule>
My httpd-vhosts.conf
<VirtualHost *:80>
DocumentRoot "/opt/lampp/htdocs/e-wallet-frontend/public"
ServerName localhost
<Directory "/opt/lampp/htdocs/e-wallet-frontend/public">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog "logs/frontendewallet.com-error_log"
CustomLog "logs/frontendewallet.com-access_log" common
</VirtualHost>
the HTTPS appears but the browser says Object not Found is there something wrong with my htaccess?
RewriteRule ^(.*)$ https://www.myproject.com/$1 [R=301,L]
This is the code I have on my multiple Laravel projects.
In local environment I can navigatate to domain.com/app but in AWS it only works if I use domain.com/public/app. I have tried a number approaches to get it to resolve without public folder
I tried 2 different approaches already:
Added .htaccess mod_rewrite but it provides an error below.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
Laravel NotFoundHttpException in compiled.php line 7610.
I do not want to rename the server.php to index.php as this is not an optimally secure approach.
In /public/.htaccess I have
<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]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
Any other way to get http to https without using Homestead?
In your virtualhost file point documentroot to public folder of laravel