tcnjdeluca Posted December 15, 2008 Share Posted December 15, 2008 I am attempting set up my server so I can have both URL routing and direct one or two pages to https automatically. I set my .htaccess to the following and redirected all my pages to https, but broke some of my URL routing. Options +FollowSymLinks IndexIgnore */* # Turn on the RewriteEngine RewriteEngine On # Rules RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . homepage.php RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://www.classchatterlive.com/$1 [R,L] AddType application/x-httpd-php .xml I do not need every page on the site to be redirected to https, if there is a way to only redirect specific pages, that would work for me as well. Thanks for your help: Quote Link to comment Share on other sites More sharing options...
tcnjdeluca Posted December 16, 2008 Author Share Posted December 16, 2008 Well seems like it would be something to take care of on the server with .htaccess, but is there anything wrong with redirecting with a little php like this $requireSSL = true; // If page requires SSL, and we're not in SSL mode, // redirect to the SSL version of the page if($requireSSL && $_SERVER['SERVER_PORT'] != 443) { header("HTTP/1.1 301 Moved Permanently"); header("Location: https://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']); exit(); } Thats not my code I found it at http://www.somacon.com/p536.php, but it seems simple and effective enough. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.