Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 909 Vote(s) - 3.54 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Force SSL / https:// using .htaccess for a Content Management System (CMS)

#1
Content Management Systems often force pages to go though an index.php route.

For example pages on the CMS I use are presented in the URL as follows.

[To see links please register here]


The .htaccess code I know only listens to the index.php part of my statement.

My current re-write code stands as follows;

RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^login/?$

[To see links please register here]

[R=301,L]

This works as it is a specific directory, however,

RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^index.php?page=263$

[To see links please register here]

[R=301,L]

does not seem to work.

Any ideas?
Reply

#2
I have a snippet I copied from a webpage somewhere. Perhaps you could give it a try?

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
Reply

#3
1. RewriteRule just matches the `path` section of the url, so it needs to be just `^index\.php$`.
2. The query string can be matched using `RewriteCond %{QUERY_STRING}`.
3. Like in aesphere's answer, testing for the special `%{HTTPS}` variable is easier than checking the port.
4. Using an absolute target URI implies `[R=301,L]` so you can remove it.
5. [QSA] appends the query string

So, you end up with:

RewriteCond %{HTTPS} off
RewriteCond %{QUERY_STRING} ^\?page=263$
RewriteRule ^index\.php$ https://%{HTTP_HOST}%{REQUEST_URI} [QSA]
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through