ScottNL1
asked on
htacces https
I have near to no experience with .htacces but i need to do the following
I have a ssl certificate for the whole website. But i only want to have a few pages secured the ssl.
example
http://www.vekto.nl/user_login.php
change to
https://www.vekto.nl/user_login.php
Now this is a easy redirect but i want a if statement implemented.
Because if the page is anything other than user_login.php i want to switch back to http
I have a ssl certificate for the whole website. But i only want to have a few pages secured the ssl.
example
http://www.vekto.nl/user_login.php
change to
https://www.vekto.nl/user_login.php
Now this is a easy redirect but i want a if statement implemented.
Because if the page is anything other than user_login.php i want to switch back to http
Sorry, just re-read the categories you posted your question in and noticed 'Apache'. I guess Netcraft is misreporting your site: http://uptime.netcraft.com/up/graph?site=www.vekto.nl
ASKER
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . friendly_url.php [L]
RewriteCond %{HTTP_HOST} ^vekto\.nl [NC]
RewriteRule ^(.*)$ http://www.vekto.nl/$1 [L,R=301]
</IfModule>
This is what is have now and it works.
I would like to add this, but not for a folder just for a page
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} payment
RewriteRule ^(.*)$ https://www.vekto.nl/payment/$1 [R,L]
If the user is not on one of the pages, i want to have a rule that it switches back to http.
Not fully understanding the 2 posts because i can redirect in my htacces. Just don't want to redirect a root folder, but a page
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . friendly_url.php [L]
RewriteCond %{HTTP_HOST} ^vekto\.nl [NC]
RewriteRule ^(.*)$ http://www.vekto.nl/$1 [L,R=301]
</IfModule>
This is what is have now and it works.
I would like to add this, but not for a folder just for a page
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} payment
RewriteRule ^(.*)$ https://www.vekto.nl/payment/$1 [R,L]
If the user is not on one of the pages, i want to have a rule that it switches back to http.
Not fully understanding the 2 posts because i can redirect in my htacces. Just don't want to redirect a root folder, but a page
Just alter the port and negate the URL match e.g.
RewriteCond %{SERVER_PORT} 443
RewriteCond %{REQUEST_URI} ! (payment|login|somethingElse) [NC]
RewriteRule .* http://www.vekto.nl/payment%{REQUEST_URI} [R,L]
Typo:
RewriteCond %{SERVER_PORT} 443
RewriteCond %{REQUEST_URI} ! (payment|login|somethingElse) [NC]
RewriteRule .* http://www.vekto.nl%{REQUEST_URI} [R,L]
ASKER
Thanks arober11
I tried it but didn't work for me
RewriteCond %{SERVER_PORT} 443
RewriteCond %{REQUEST_URI} ! (user_login|user_home|user _profile|u ser_orders |order_inf o) [NC]
RewriteRule .* http://www.vekto.nl%{REQUEST_URI} [R,L]
When i type
https://www.vekto.nl/user_login.php it redirects to http
I tried it but didn't work for me
RewriteCond %{SERVER_PORT} 443
RewriteCond %{REQUEST_URI} ! (user_login|user_home|user
RewriteRule .* http://www.vekto.nl%{REQUEST_URI} [R,L]
When i type
https://www.vekto.nl/user_login.php it redirects to http
ASKER
any body have any ideas?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
In terms of enabling https for the login page only via your .htaccess, I'm not entirely sure that's possible. If you're using cookies to pass sessions between pages, I don't believe you can pass them from https to http pages (or vice-versa). This post explains better than I can: http://www.codingforums.com/showthread.php?t=128416
Perhaps your solution will be a little more complicated?