apache - Forcing https:// through htaccess -
apache - Forcing https:// through htaccess -
i'm new coding in general please forgive me ignorance in subject. understand few questions similar this, none have seemed work me. useful info welcome please due you're best explain me if seems bit excessive because i'm uneducated in theses particular subjects.
here entire htaccess file located in root forum directory.
class="snippet-code-html lang-html prettyprint-override">rewriteoptions inherit rewriteengine on <ifmodule mod_rewrite.c> options -multiviews rewriteengine on rewritebase /forums/ rewritecond %{request_filename} !-f rewriterule \.(jpeg|jpg|gif|png)$ /forums/public/404.php [nc,l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /forums/index.php [l] </ifmodule> <files 403.shtml> order allow,deny allow </files> rewritecond %{http_host} ^perspectiverp\.com$ [or] rewritecond %{http_host} ^www\.perspectiverp\.com$ rewriterule ^home$ "https\:\/\/www\.perspectiverp\.com\/forums\/" [r=301,l] rewritecond %{http_host} ^perspectiverp\.com$ [or] rewritecond %{http_host} ^www\.perspectiverp\.com$ rewriterule ^home$ "https\:\/\/www\.perspectiverp\.com\/forums\/" [r=301,l] rewritecond %{http_host} ^perspectiverp\.com$ [or] rewritecond %{http_host} ^www\.perspectiverp\.com$ rewriterule ^/?$ "https\:\/\/www\.perspectiverp\.com\/forums\/" [r=301,l]
my site connect website through https:// unless beingness straight told otherwise e.g. http://perspectiverp.com/forums/. issue general connection beingness directed through https:// users can still connect through http:// major security flaw. need similar how google has scheme automatically redirect http:// https:// if user attempts alter in web address
e.g. http:/ww.google.com/ gets redirected https:/ww.google.com/?gws_rd=ssl if user attempts alter to*http:/ww.google.com/.
as wanting know forum software is, i'm using licensed version of invision powers community suit.
// updated first effort result "webpage has redirect loop"
rewriteoptions inherit rewriteengine on <ifmodule mod_rewrite.c> options -multiviews rewriteengine on rewritebase /forums/ rewritecond %{request_filename} !-f rewriterule \.(jpeg|jpg|gif|png)$ /forums/public/404.php [nc,l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /forums/index.php [l] </ifmodule> <files 403.shtml> order allow,deny allow </files> rewritecond %{https} =off rewriterule ^ https://www.perspectiverp.com%{request_uri} [r,l] rewritecond %{http_host} ^(www\.)?perspectiverp\.com$ [nc] rewriterule ^(home)?$ https://www.perspectiverp.com/forums/ [r=301,nc,l] second effort result "webpage has redirect loop"
rewriteoptions inherit rewriteengine on <ifmodule mod_rewrite.c> options -multiviews rewriteengine on rewritebase /forums/ rewritecond %{request_filename} !-f rewriterule \.(jpeg|jpg|gif|png)$ /forums/public/404.php [nc,l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /forums/index.php [l] </ifmodule> <files 403.shtml> order allow,deny allow </files> rewritecond %{https} =off rewriterule ^ https://www.perspectiverp.com%{request_uri} [r,l] rewritecond %{http_host} ^(www\.)?perspectiverp\.com$ [nc] rewriterule ^home$ https://www.perspectiverp.com/forums/ [r=301,nc,l third effort result "webpage has redirect loop"
rewriteoptions inherit rewriteengine on <ifmodule mod_rewrite.c> options -multiviews rewriteengine on rewritebase /forums/ rewritecond %{request_filename} !-f rewriterule \.(jpeg|jpg|gif|png)$ /forums/public/404.php [nc,l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /forums/index.php [l] </ifmodule> <files 403.shtml> order allow,deny allow </files> rewritecond %{https} =off rewriterule ^ https://www.perspectiverp.com%{request_uri} [r,l] rewritecond %{http_host} ^perspectiverp\.com$ [or] rewritecond %{http_host} ^www\.perspectiverp\.com$ rewriterule ^home$ "https\:\/\/www\.perspectiverp\.com\/forums\/" [r=301,l] rewritecond %{http_host} ^perspectiverp\.com$ [or] rewritecond %{http_host} ^www\.perspectiverp\.com$ rewriterule ^home$ "https\:\/\/www\.perspectiverp\.com\/forums\/" [r=301,l] rewritecond %{http_host} ^perspectiverp\.com$ [or] rewritecond %{http_host} ^www\.perspectiverp\.com$
add next before lastly 3 https:// rewrite rules.
rewritecond %{https} =off rewriterule ^ https://www.perspectiverp.com%{request_uri} [r,l] once works expected alter r r=301 above. also, notice how url in rewrite rule not quote , escape forwards slashes isn't required.
you can replace lastly 3 rules one:
rewritecond %{http_host} ^(www\.)?perspectiverp\.com$ [nc] rewriterule ^(home)?$ https://www.perspectiverp.com/forums/ [r=301,nc,l] the nc flag makes rule case-insensitive home , home both match. ? makes preceding grouping () optional; rewritecond works both www , without it, , rewriterule matches on / well.
apache .htaccess http redirect https
Comments
Post a Comment