If I want to access my site http://www.myawesomesite.com it simply rewrites to www.myawesomesite.com.
I host my site on my VPS and I not tinkered my .htaccess.
How to tell the rewrite engine, that I want to see the http allways if I'm on that VPS? (and not on local)
My .htaccess file is:
<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>
Related
I never coded in Laravel and one of my clients has a website built with Laravel that he recently switched to HTTPS.
The site open but all the images/videos/files open in HTTP and not HTTPS.
They use this format: /img/image.png instead of a full URL.
Any idea how to make it so that every single link/image/video opens in HTTPS?
The below is my htaccess file:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
#force https
RewriteCond %{HTTP:X-Forwarded-Proto} =http
RewriteRule .* https://%{HTTP:Host}%{REQUEST_URI} [L,R=permanent]
# 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>
The website opens in HTTPS but some assets don't.
I have made virtual server for Laravel 5.4 project, it is laravel.cs when I open homepage it opens http://laravel.cs but when I click on any other link it opens with HTTPs therefore getting 404 Error.
.htacess file
# Laravel 5 Rewrites
<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>
I also tried by SSL engine OFF in xampp httpd-ssl-conf, but not worked
In my Dev server which is on my pc, I set up vhost to change my URL to dmb.dev to remove the public in URL so many of my routes started at / slash. After I transfer my project to our test server I configure some settings to allow me to remove public. Now, all assets are working except my routes because I'm still having http://server/dmb instead of http://server I'm getting an error of Failed to load resource: /myurl.
My sample routes
Route::get('/', 'PagesController#index')->name('index');
Route::get('/generate_bing', 'PagesController#generateImage')->name('index.getImage');
Route::get('/users', 'PagesController#showUser')->name('users')->middleware('auth','role:owner');
My root htaccess
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# 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]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
Do I need to change all routes to dmb/etc.. I'm thinking of solution of removing my root folder so it would look like http://server, but there's other project on our htdocs so I need to remain it store in their folders. BTW I'm using xampp
As you have dmb as your folder under public_html, adding one line to your htaccess would solve the issue.
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteBase /dmb/ // ADD THIS LINE HERE
# 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]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
I have installed WordPress in root directory, I want to install laravel lumen inside a subdirectory. It gives wordpress error " No Page Found!".
I can access files from other directories.
My lumen .htaccess file code is
<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}]
I have nothing special in wordpress .htaccess file.
What i have to do ?
Update your .htaccess file. Add
RewriteCond $1 !^(YOUR_LUMEN_DIRECTORY)
After
RewriteEngine On
Sample .htaccess rules:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteCond $1 !^(YOUR_LUMEN_DIRECTORY)
# 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}]
I'm new in Laravel. I develop a project on my local computer and it works properly. But when I publish it to the server, I just can see the main page and pretty URLs (contain CSS files and all other directories) and Laravel routes doesn't work.
Here is my configurations:
debeian 8
apache
PHP 5.6.24-0+deb8u1
.htaccess content on laravel/public:
<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>
How can I fix this?