Viszman
Viszman

Reputation: 1398

apache .htcaccess redirect to https

i have problem with redirecting login page to https when i do this way:

# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{HTTPS} off
RewriteRule ^login https://sklep.galmet.com.pl/login [L,R=301]

# otherwise forward it to index.php
RewriteRule . index.php

this works when i go to shop.abcdomain.com.pl/logn im redirected to https://shop.abcdomain.com.pl/logn but all files like .css, .jpeg and so on are not loaded i think its because of this line RewriteRule . index.php but i don't know how to resolve this

Upvotes: 0

Views: 73

Answers (3)

Raggamuffin
Raggamuffin

Reputation: 1760

RewriteCond will only apply to the first rule it comes to.. so your check for file / directory won't apply to not passing to index.php. try this:

# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{HTTPS} off
RewriteRule ^login https://sklep.galmet.com.pl/login [L,R=301]

# otherwise forward it to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php

Upvotes: 1

Imran Amanat
Imran Amanat

Reputation: 41

Add this in to your apache .htcaccess file

1. - options FollowSymLinks
2. - options +Multiviews

Upvotes: 0

Chintan Parekh
Chintan Parekh

Reputation: 1101

Link all your assets(css/js) file with '/' at beginning, and it should work fine.

Upvotes: 0

Related Questions