What i am trying to do is rewrite some URLs and apply SSL on certaing pages on my site.

This is the code that i have:

  RewriteEngine on
    RewriteBase /
    RewriteRule ^mylogin$ index.php?view=login [QSA,L,NC]
    RewriteRule ^registerme$ index.php?view=register [QSA,L,NC]
    RewriteCond %{HTTPS} off
    RewriteRule ^(mylogin|registerme)/?$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NC]

This works to the extent that: I am able to access http(s)://example.com/mylogin both. Also http(s)://example.com/index.php?view=login is still available. My goal is to have only one active URL https://example.com/mylogin .

Another thing is that i have a lot of pages on my site tied to index.php. What i would like to do is when someone opens http://example.com to go to https://example.com.

I also have rewites for the pages that i need to force them to http://

RewriteRule ^viewpr$     index.php?view=products  [QSA,L,NC]
RewriteRule ^wall$       wall.php                  [QSA,L,NC]
RewriteRule ^services$   services.php              [QSA,L,NC]
RewriteRule ^exchange$  exp_exchange.php?view=exp       [QSA,L,NC]

So to summarize i need https://example.com , https://example.com/mylogin and https://example.com/registerme, and i need only those options available.

For the rewrites on the bottom same thing but on http:// . Honestly i dont care about the other URLs. Please advice.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.