1. Osclass Forum
  2. General
  3. Question to my .htaccess

Question to my .htaccess

Started by Sascha, January 30, 2021, 1:19 pm

  • 1

Sascha

Question to my .htaccess

on :January 30, 2021, 1:19 pm #401

Hello together


I installed a SSL-Certificate on my hosting. Now i need a redirect to use only https://

One guy wrote me this folliwing .htaccess years before...is this correct?

I only replaces my real domain with "doman", all others is 1:1


<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

# Redirect from https to http
RewriteCond %{SERVER_PORT}  ^443$
RewriteRule  (.*)  http://%{HTTP_HOST}/$1  [R=301,L]

#RewriteCond %{SERVER_PORT}  !^443$
#RewriteRule  (.*)  https://%{HTTP_HOST}/$1  [R=301,L]

RewriteRule ^index\.php$ - [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [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

RewriteCond %{HTTP_REFERER} !^http://www.domain.ch/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.domain.ch$      [NC]
RewriteCond %{HTTP_REFERER} !^http://domain.ch/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://domain.ch$      [NC]
RewriteCond %{HTTP_REFERER} !^https://www.domain.ch/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^https://www.domain.ch$      [NC]
RewriteCond %{HTTP_REFERER} !^https://domain.ch/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^https://domain.ch$      [NC]
RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]

calinbehtuk

Re: Question to my .htaccess

on :January 30, 2021, 6:37 pm #402

Sorry but I not an expert on redirection using .htaccess


This is what I am using on my site


Code: [Select]
​<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>


  • << Last edit: January 30, 2021, 7:43 pm by calinbehtuk >>
  • Quote

Sascha

Re: Question to my .htaccess

on :January 30, 2021, 7:30 pm #403

Thank you very much, now it works!

  • 1
Subscribe
X

Subscribe!

Subscribe to get the latest listings, updates and special offers delivered directly in your inbox.